[FEAT MERGE]4_2_sql_feature
Co-authored-by: yinyj17 <yinyijun92@gmail.com> Co-authored-by: xianyu-w <707512433@qq.com> Co-authored-by: jingtaoye35 <1255153887@qq.com>
This commit is contained in:
@ -469,21 +469,25 @@ int ObUpdateLogPlan::perform_vector_assign_expr_replacement(ObUpdateStmt *stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObUpdateTableInfo* table_info = nullptr;
|
||||
ObSQLSessionInfo* session_info = optimizer_context_.get_session_info();
|
||||
if (OB_ISNULL(stmt) || OB_ISNULL(table_info = stmt->get_update_table_info().at(0))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("stmt is null", K(ret), K(stmt), K(table_info));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < table_info->assignments_.count(); ++i) {
|
||||
ObRawExpr *value = table_info->assignments_.at(i).expr_;
|
||||
if (OB_FAIL(replace_alias_ref_expr(value))) {
|
||||
bool replace_happened = false;
|
||||
if (OB_FAIL(replace_alias_ref_expr(value, replace_happened))) {
|
||||
LOG_WARN("failed to replace alias ref expr", K(ret));
|
||||
} else if (replace_happened && OB_FAIL(value->formalize(session_info))) {
|
||||
LOG_WARN("failed to foramlize expr", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObUpdateLogPlan::replace_alias_ref_expr(ObRawExpr *&expr)
|
||||
int ObUpdateLogPlan::replace_alias_ref_expr(ObRawExpr *&expr, bool &replace_happened)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(expr)) {
|
||||
@ -496,10 +500,11 @@ int ObUpdateLogPlan::replace_alias_ref_expr(ObRawExpr *&expr)
|
||||
LOG_WARN("invalid alias expr", K(ret), K(*alias));
|
||||
} else {
|
||||
expr = alias->get_ref_expr();
|
||||
replace_happened = true;
|
||||
}
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < expr->get_param_count(); ++i) {
|
||||
if (OB_FAIL(replace_alias_ref_expr(expr->get_param_expr(i)))) {
|
||||
if (OB_FAIL(replace_alias_ref_expr(expr->get_param_expr(i), replace_happened))) {
|
||||
LOG_WARN("failed to replace alias ref expr", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user