fix nullif/least calc_resultN bug in static engine

This commit is contained in:
st0
2022-03-23 14:01:09 +08:00
committed by LINxiansheng
parent edb1623a7c
commit fd436db3f8
11 changed files with 49 additions and 70 deletions

View File

@ -767,14 +767,16 @@ int ObRawExprWrapEnumSet::wrap_nullif_expr(ObSysFunRawExpr& expr)
int ret = OB_SUCCESS;
int64_t param_count = expr.get_param_count();
int64_t input_types_count = expr.get_input_types().count();
bool param_copied = false;
if (OB_UNLIKELY(OB_ISNULL(my_session_))) {
ret = OB_NOT_INIT;
LOG_WARN("session is null", K(ret));
} else if (OB_UNLIKELY(T_FUN_SYS_NULLIF != expr.get_expr_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(expr), K(ret));
} else if (OB_UNLIKELY((my_session_->use_static_typing_engine() && 6 != param_count) ||
(!my_session_->use_static_typing_engine() && 2 != param_count))) {
} else if (FALSE_IT(param_copied = my_session_->use_static_typing_engine() && !is_oracle_mode())) {
} else if (OB_UNLIKELY((param_copied && 6 != param_count)
|| (!param_copied && 2 != param_count))) {
// For the new engine, due to the copy of the nullif parameter,
// there are actually 3 sets of parameters: the original input parameter,
// the calc type parameter and the result parameter, so there are 6 in total
@ -784,7 +786,7 @@ int ObRawExprWrapEnumSet::wrap_nullif_expr(ObSysFunRawExpr& expr)
ret = OB_ERR_UNEXPECTED;
LOG_WARN("param_count is not equal to input_types_count", K(param_count), K(input_types_count), K(ret));
} else {
for (int i = 0; i < param_count / 2; ++i) {
for (int i = 0; i < param_count && OB_SUCC(ret); i += 2) {
ObRawExpr* left_param = expr.get_param_expr(i);
ObRawExpr* right_param = expr.get_param_expr(i + 1);
if (OB_ISNULL(left_param) || OB_ISNULL(right_param)) {