Fix a bug when allocate shared expr in link stmt

This commit is contained in:
xianyu-w
2023-05-06 09:38:34 +00:00
committed by ob-robot
parent 90aad03502
commit 527f1b1cbb
2 changed files with 15 additions and 0 deletions

View File

@ -1880,6 +1880,8 @@ int ObLogicalOperator::add_expr_to_ctx(ObAllocExprContext &ctx,
if (OB_ISNULL(expr)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (log_op_def::LOG_LINK_SCAN == get_type()) {
// do not extract shared exprs for link op
} else if (OB_FAIL(extract_shared_exprs(expr,
ctx,
0,

View File

@ -451,6 +451,19 @@ int ObTransformDBlink::pack_link_table(ObDMLStmt *stmt, bool &trans_happened)
LOG_TRACE("succeed to pack one link stmt", K(helpers.at(i)));
}
}
} else if (stmt->is_set_stmt()) {
ObSelectStmt *sel_stmt = static_cast<ObSelectStmt *>(stmt);
for (int64_t i = 0; OB_SUCC(ret) && i < sel_stmt->get_set_query().count(); ++i) {
ObSelectStmt *child_stmt = sel_stmt->get_set_query(i);
if (OB_ISNULL(child_stmt)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(ret));
} else if (!child_stmt->is_dblink_stmt()) {
// do nothing
} else if (OB_FAIL(ObTransformUtils::pack_stmt(ctx_, static_cast<ObSelectStmt *>(child_stmt)))) {
LOG_WARN("failed to pack link stmt", K(ret));
}
}
}
return ret;
}