[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

@ -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_,