Fixbug46241845: OB hits the wrong cached plan when rollup exprs contains const exprs

This commit is contained in:
obdev
2022-12-08 03:08:14 +00:00
committed by ob-robot
parent 0b093e2a76
commit e57d864e41
10 changed files with 157 additions and 244 deletions

View File

@ -805,11 +805,15 @@ bool ObExprEqualCheckContext::compare_const(const ObConstRawExpr &left,
int &ret = err_code_;
bool result = false;
if (left.get_result_type() == right.get_result_type()) {
const ObObj &this_value = left.get_value().is_unknown() ?
if (ignore_param_ && (left.get_value().is_unknown() || right.get_value().is_unknown())) {
result = true;
} else {
const ObObj &this_value = left.get_value().is_unknown() ?
left.get_result_type().get_param() : left.get_value();
const ObObj &other_value = right.get_value().is_unknown() ?
const ObObj &other_value = right.get_value().is_unknown() ?
right.get_result_type().get_param() : right.get_value();
result = this_value.is_equal(other_value, CS_TYPE_BINARY);
result = this_value.is_equal(other_value, CS_TYPE_BINARY);
}
}
if (OB_SUCC(ret) && result && left.get_value().is_unknown()) {
if (OB_FAIL(add_param_pair(left.get_value().get_unknown(), NULL))) {

View File

@ -1191,7 +1191,8 @@ struct ObExprEqualCheckContext
override_set_op_compare_(false),
err_code_(common::OB_SUCCESS),
param_expr_(),
need_check_deterministic_(false)
need_check_deterministic_(false),
ignore_param_(false)
{ }
ObExprEqualCheckContext(bool need_check_deterministic)
: override_const_compare_(false),
@ -1202,7 +1203,8 @@ struct ObExprEqualCheckContext
override_set_op_compare_(false),
err_code_(common::OB_SUCCESS),
param_expr_(),
need_check_deterministic_(need_check_deterministic)
need_check_deterministic_(need_check_deterministic),
ignore_param_(false)
{ }
virtual ~ObExprEqualCheckContext() {}
struct ParamExprPair
@ -1248,6 +1250,7 @@ struct ObExprEqualCheckContext
err_code_ = OB_SUCCESS;
param_expr_.reset();
need_check_deterministic_ = false;
ignore_param_ = false;
}
bool override_const_compare_;
bool override_column_compare_;
@ -1259,6 +1262,7 @@ struct ObExprEqualCheckContext
//when compare with T_QUESTIONMARK, as T_QUESTIONMARK is unkown, record this first.
common::ObSEArray<ParamExprPair, 3, common::ModulePageAllocator, true> param_expr_;
bool need_check_deterministic_;
bool ignore_param_; // only compare structure of expr
};
struct ObExprParamCheckContext : ObExprEqualCheckContext