fix group by with rollup inherit incorrect sharding

This commit is contained in:
ChangerR
2023-05-19 03:52:32 +00:00
committed by ob-robot
parent 69405ba6eb
commit f26e28456f
2 changed files with 28 additions and 1 deletions

View File

@ -832,5 +832,30 @@ int ObLogGroupBy::is_my_fixed_expr(const ObRawExpr *expr, bool &is_fixed)
is_fixed = ObOptimizerUtil::find_item(aggr_exprs_, expr) ||
(T_FUN_SYS_REMOVE_CONST == expr->get_expr_type() && ObOptimizerUtil::find_item(rollup_exprs_, expr));
}
return OB_SUCCESS;
return ret;
}
int ObLogGroupBy::compute_sharding_info()
{
int ret = OB_SUCCESS;
if (ObRollupStatus::ROLLUP_COLLECTOR == rollup_adaptive_info_.rollup_status_) {
ObLogicalOperator *child = NULL;
if (get_num_of_child() == 0) {
/*do nothing*/
} else if (OB_ISNULL(child = get_child(ObLogicalOperator::first_child))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (child->get_strong_sharding() != NULL &&
OB_FAIL(weak_sharding_.push_back(child->get_strong_sharding()))) {
LOG_WARN("failed to push back weak sharding");
} else if (OB_FAIL(append(weak_sharding_, child->get_weak_sharding()))) {
LOG_WARN("failed to assign sharding info", K(ret));
} else {
inherit_sharding_index_ = ObLogicalOperator::first_child;
strong_sharding_ = NULL;
}
} else if (OB_FAIL(ObLogicalOperator::compute_sharding_info())) {
LOG_WARN("failed to compute sharding info", K(ret));
}
return ret;
}

View File

@ -213,6 +213,8 @@ public:
virtual int get_plan_item_info(PlanText &plan_text,
ObSqlPlanItem &plan_item) override;
virtual int compute_sharding_info() override;
VIRTUAL_TO_STRING_KV(K_(group_exprs), K_(rollup_exprs), K_(aggr_exprs), K_(algo), K_(distinct_card),
K_(is_push_down));
private: