[CP] fix ObOpRawExpr's inner_same_as bug

This commit is contained in:
jingtaoye35
2024-03-19 08:01:01 +00:00
committed by ob-robot
parent a0db539f24
commit 895108db8a
5 changed files with 49 additions and 8 deletions

View File

@ -4538,7 +4538,7 @@ int ObDMLStmt::disable_writing_external_table(bool basic_stmt_is_dml /* defualt
} else if (schema::EXTERNAL_TABLE == table_item->table_type_) {
disable_write_table = true;
} else if (table_item->is_view_table_ && NULL != table_item->ref_query_) {
OZ( table_item->ref_query_->disable_writing_external_table(true) );
OZ( SMART_CALL(table_item->ref_query_->disable_writing_external_table(true)) );
}
}
}
@ -4551,7 +4551,7 @@ int ObDMLStmt::disable_writing_external_table(bool basic_stmt_is_dml /* defualt
LOG_WARN("failed to get stmt's child_stmts", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < child_stmts.count(); ++i) {
OZ( child_stmts.at(i)->disable_writing_external_table() );
OZ( SMART_CALL(child_stmts.at(i)->disable_writing_external_table()) );
}
}
}

View File

@ -1609,7 +1609,9 @@ bool ObQueryRefRawExpr::inner_same_as(
bool bool_ret = false;
if (get_expr_type() == expr.get_expr_type()) {
const ObQueryRefRawExpr &u_expr = static_cast<const ObQueryRefRawExpr &>(expr);
if (check_context != NULL && check_context->override_query_compare_) {
if (is_set_ != u_expr.is_set_ || is_multiset_ != u_expr.is_multiset_) {
/* bool bool_ret = false; */
} else if (check_context != NULL && check_context->override_query_compare_) {
bool_ret = check_context->compare_query(*this, u_expr);
} else {
// very tricky, check the definition of ref_stmt_ and get_ref_stmt()
@ -2356,6 +2358,27 @@ void ObOpRawExpr::clear_child()
exprs_.reset();
}
int ObOpRawExpr::get_subquery_comparison_flag() const
{
enum {
INVALID = 0, // not subquery comparison
NONE = 1,
ALL = 2,
ANY = 3
} comparison_flag;
comparison_flag = INVALID;
if (IS_SUBQUERY_COMPARISON_OP(get_expr_type())) {
if (has_flag(IS_WITH_ALL)) {
comparison_flag = ALL;
} else if (has_flag(IS_WITH_ANY)) {
comparison_flag = ANY;
} else {
comparison_flag = NONE;
}
}
return comparison_flag;
}
bool ObOpRawExpr::inner_same_as(
const ObRawExpr &expr,
ObExprEqualCheckContext *check_context) const
@ -2393,6 +2416,12 @@ bool ObOpRawExpr::inner_same_as(
} else {
need_cmp = false;
}
} else if (IS_SUBQUERY_COMPARISON_OP(get_expr_type())) {
const ObOpRawExpr &tmp = static_cast<const ObOpRawExpr &>(expr);
if (tmp.get_expr_type() != get_expr_type() ||
tmp.get_subquery_comparison_flag() != get_subquery_comparison_flag()) {
need_cmp = false;
}
} else if (expr.get_expr_type() != get_expr_type()) {
need_cmp = false;
}

View File

@ -2958,6 +2958,7 @@ public:
int64_t &pos,
ExplainType type) const;
bool is_white_runtime_filter_expr() const override;
int get_subquery_comparison_flag() const;
VIRTUAL_TO_STRING_KV_CHECK_STACK_OVERFLOW(N_ITEM_TYPE, type_,
N_RESULT_TYPE, result_type_,
N_EXPR_INFO, info_,