disable extract shared child exprs for dblink stmt
This commit is contained in:
@ -1400,6 +1400,8 @@ int ObLogicalOperator::do_pre_traverse_operation(const TraverseOp &op, void *ctx
|
||||
LOG_WARN("get unexpected null", K(session), K(ret));
|
||||
} else if (is_plan_root() && OB_FAIL(adjust_plan_root_output_exprs())) {
|
||||
LOG_WARN("failed to set plan root output", K(ret));
|
||||
} else if (is_plan_root() && OB_FAIL(collecte_inseparable_exprs(*alloc_expr_context))) {
|
||||
LOG_WARN("failed to set plan root output", K(ret));
|
||||
} else if (OB_FAIL(allocate_expr_pre(*alloc_expr_context))) {
|
||||
LOG_WARN("failed to do allocate expr pre", K(ret));
|
||||
} else {
|
||||
@ -1686,6 +1688,22 @@ int ObLogicalOperator::mark_expr_produced(ObRawExpr *expr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogicalOperator::collecte_inseparable_exprs(ObAllocExprContext &ctx)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const ObDMLStmt *stmt = NULL;
|
||||
if (OB_ISNULL(stmt = get_stmt())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(stmt), K(ret));
|
||||
} else if (stmt->is_dblink_stmt() && stmt->is_select_stmt()) {
|
||||
const ObSelectStmt *sel_stmt = static_cast<const ObSelectStmt *>(stmt);
|
||||
if (OB_FAIL(sel_stmt->get_select_exprs(ctx.inseparable_exprs_))) {
|
||||
LOG_WARN("failed to get select exprs", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogicalOperator::allocate_expr_pre(ObAllocExprContext &ctx)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -1880,8 +1898,6 @@ 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,
|
||||
@ -2044,12 +2060,14 @@ int ObLogicalOperator::extract_shared_exprs(ObRawExpr *raw_expr,
|
||||
LOG_WARN("failed to add var to array", K(ret));
|
||||
}
|
||||
|
||||
if (!ObOptimizerUtil::find_item(ctx.inseparable_exprs_, raw_expr)) {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < raw_expr->get_param_count(); ++i) {
|
||||
ret = SMART_CALL(extract_shared_exprs(raw_expr->get_param_expr(i),
|
||||
ctx,
|
||||
ref_cnt,
|
||||
shard_exprs));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -651,6 +651,8 @@ struct ObAllocExprContext
|
||||
// {key => flattern expr, value => reference count }
|
||||
hash::ObHashMap<uint64_t, int64_t> flattern_expr_map_;
|
||||
common::ObSEArray<ExprProducer, 16, common::ModulePageAllocator, true> expr_producers_;
|
||||
// Exprs that cannot be used to extract shared child exprs
|
||||
common::ObSEArray<ObRawExpr *, 4, common::ModulePageAllocator, true> inseparable_exprs_;
|
||||
};
|
||||
|
||||
struct ObPxPipeBlockingCtx
|
||||
@ -1185,6 +1187,8 @@ public:
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
|
||||
int collecte_inseparable_exprs(ObAllocExprContext &ctx);
|
||||
|
||||
virtual int allocate_expr_pre(ObAllocExprContext &ctx);
|
||||
|
||||
virtual int get_op_exprs(ObIArray<ObRawExpr*> &all_exprs);
|
||||
|
||||
@ -453,19 +453,6 @@ 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user