fix pdml allocate partition id expr bug

This commit is contained in:
chimyue
2023-11-01 09:43:40 +00:00
committed by ob-robot
parent 2727d88048
commit d0efaee70e
3 changed files with 13 additions and 8 deletions

View File

@ -493,6 +493,7 @@ int ObLogDelUpd::generate_pdml_partition_id_expr()
} else if (OB_FAIL(ObLogicalOperator::generate_pseudo_partition_id_expr(partition_id_expr))) { } else if (OB_FAIL(ObLogicalOperator::generate_pseudo_partition_id_expr(partition_id_expr))) {
LOG_WARN("fail allocate part id expr", K(table_id), K(ret)); LOG_WARN("fail allocate part id expr", K(table_id), K(ret));
} else if (OB_FAIL(find_pdml_part_id_producer(*this, } else if (OB_FAIL(find_pdml_part_id_producer(*this,
index_dml_infos_.at(0)->loc_table_id_,
index_dml_infos_.at(0)->ref_table_id_, index_dml_infos_.at(0)->ref_table_id_,
producer))) { producer))) {
LOG_WARN("find pdml partition id expr producer failed", K(ret)); LOG_WARN("find pdml partition id expr producer failed", K(ret));
@ -514,7 +515,8 @@ int ObLogDelUpd::generate_pdml_partition_id_expr()
} }
int ObLogDelUpd::find_pdml_part_id_producer(ObLogicalOperator &op, int ObLogDelUpd::find_pdml_part_id_producer(ObLogicalOperator &op,
const uint64_t tid, const uint64_t loc_tid,
const uint64_t ref_tid,
ObLogicalOperator *&producer) ObLogicalOperator *&producer)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
@ -523,7 +525,8 @@ int ObLogDelUpd::find_pdml_part_id_producer(ObLogicalOperator &op,
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (op.get_type() == log_op_def::LOG_EXCHANGE) { if (op.get_type() == log_op_def::LOG_EXCHANGE) {
ObLogExchange &log_ex = static_cast<ObLogExchange &>(op); ObLogExchange &log_ex = static_cast<ObLogExchange &>(op);
if (log_ex.is_producer() && log_ex.get_repartition_ref_table_id() == tid) { if (log_ex.is_producer() && log_ex.get_repartition_ref_table_id() == ref_tid
&& log_ex.get_repartition_table_id() == loc_tid) {
producer = &op; producer = &op;
} }
} else if (op.get_type() == log_op_def::LOG_TABLE_SCAN) { } else if (op.get_type() == log_op_def::LOG_TABLE_SCAN) {
@ -545,8 +548,8 @@ int ObLogDelUpd::find_pdml_part_id_producer(ObLogicalOperator &op,
// 后期会进行优化,如果insert与subplan是一个full partition wise // 后期会进行优化,如果insert与subplan是一个full partition wise
// join,那么就在insert算子上分配一个GI算子,目前先使用在subplan上分配EX算子的方式实现 // join,那么就在insert算子上分配一个GI算子,目前先使用在subplan上分配EX算子的方式实现
ObLogTableScan &tsc = static_cast<ObLogTableScan &>(op); ObLogTableScan &tsc = static_cast<ObLogTableScan &>(op);
if (tid if (loc_tid == tsc.get_table_id() &&
== (tsc.get_is_index_global() ? tsc.get_index_table_id() : tsc.get_ref_table_id())) { ref_tid == (tsc.get_is_index_global() ? tsc.get_index_table_id() : tsc.get_ref_table_id())) {
producer = &op; producer = &op;
} }
} }
@ -563,10 +566,10 @@ int ObLogDelUpd::find_pdml_part_id_producer(ObLogicalOperator &op,
first_child == i) { first_child == i) {
continue; continue;
} }
if (OB_FAIL(find_pdml_part_id_producer(*op.get_child(i), tid, producer))) { if (OB_FAIL(find_pdml_part_id_producer(*op.get_child(i), loc_tid, ref_tid, producer))) {
LOG_WARN("find pdml part id producer failed", K(ret)); LOG_WARN("find pdml part id producer failed", K(ret));
} }
} else if (OB_FAIL(find_pdml_part_id_producer(*op.get_child(i), tid, producer))) { } else if (OB_FAIL(find_pdml_part_id_producer(*op.get_child(i), loc_tid, ref_tid, producer))) {
LOG_WARN("find pdml part id producer failed", K(ret)); LOG_WARN("find pdml part id producer failed", K(ret));
} }
} }

View File

@ -386,7 +386,8 @@ protected:
// The pseudo partition_id for PDML may be produced by repart exchange or TSC. // The pseudo partition_id for PDML may be produced by repart exchange or TSC.
// set %producer to NULL if not found // set %producer to NULL if not found
static int find_pdml_part_id_producer(ObLogicalOperator &op, static int find_pdml_part_id_producer(ObLogicalOperator &op,
const uint64_t tid, const uint64_t loc_tid,
const uint64_t ref_tid,
ObLogicalOperator *&producer); ObLogicalOperator *&producer);
virtual int get_plan_item_info(PlanText &plan_text, virtual int get_plan_item_info(PlanText &plan_text,

View File

@ -736,8 +736,9 @@ int ObSelectLogPlan::create_hash_group_plan(const ObIArray<ObRawExpr*> &reduce_e
origin_child_card, origin_child_card,
is_partition_wise))) { is_partition_wise))) {
LOG_WARN("failed to allocate group by as top", K(ret)); LOG_WARN("failed to allocate group by as top", K(ret));
} } else {
static_cast<ObLogGroupBy*>(top)->set_group_by_outline_info(true, false); static_cast<ObLogGroupBy*>(top)->set_group_by_outline_info(true, false);
}
} else { } else {
// allocate push down group by // allocate push down group by
if (groupby_helper.can_basic_pushdown_) { if (groupby_helper.can_basic_pushdown_) {