From 7de309dcc70a5929e95786299ef4d0dfc314bbd7 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 2 Aug 2023 10:42:47 +0000 Subject: [PATCH] bugfix resolve between node when types are inconsistent --- .../expr/ob_raw_expr_resolver_impl.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp index 5c1573cef8..e14707034d 100644 --- a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp @@ -3297,15 +3297,6 @@ int ObRawExprResolverImpl::process_between_node(const ParseNode *node, ObRawExpr LOG_WARN("unexpected null", K(ret), K(i)); } } - // The content of the 4th raw expr is same to that of the 1st raw expr. - // But the ptr addresses need to be different because our optimizer relys on it. - if (OB_FAIL(ret)) { - } else if (OB_FAIL(recursive_resolve(node->children_[0], btw_params[BTW_PARAM_NUM]))) { - SQL_RESV_LOG(WARN, "resolve child expr failed", K(ret), K(BTW_PARAM_NUM)); - } else if (OB_ISNULL(btw_params[BTW_PARAM_NUM])) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected null", K(ret), K(BTW_PARAM_NUM)); - } if (OB_SUCC(ret) && lib::is_mysql_mode()) { if (OB_ISNULL(ctx_.session_info_)) { ret = OB_ERR_UNEXPECTED; @@ -3331,6 +3322,19 @@ int ObRawExprResolverImpl::process_between_node(const ParseNode *node, ObRawExpr } } } + // The content of the 4th raw expr is same to that of the 1st raw expr. + // But the ptr addresses need to be different because our optimizer relys on it. + if (OB_SUCC(ret)) { + if (lib::is_mysql_mode() && !can_transform_in_mysql_mode) { + // do nothing + } else { + if (OB_FAIL(recursive_resolve(node->children_[0], btw_params[BTW_PARAM_NUM]))) { + SQL_RESV_LOG(WARN, "resolve child expr failed", K(ret), K(BTW_PARAM_NUM)); + } else if (OB_ISNULL(btw_params[BTW_PARAM_NUM])) { + LOG_WARN("unexpected null", K(ret), K(BTW_PARAM_NUM)); + } + } + } if (OB_SUCC(ret)) { if ((lib::is_oracle_mode() || can_transform_in_mysql_mode)) { // convert between expr to >= and <=