From af229ed04bfba7e168c85310f4a96cea4fdf5bcb Mon Sep 17 00:00:00 2001 From: obdev Date: Fri, 8 Sep 2023 12:48:16 +0800 Subject: [PATCH] fix query range bug when union in node with other node --- src/sql/rewrite/ob_query_range.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sql/rewrite/ob_query_range.cpp b/src/sql/rewrite/ob_query_range.cpp index 6092b53f4c..2a1bd43d3a 100644 --- a/src/sql/rewrite/ob_query_range.cpp +++ b/src/sql/rewrite/ob_query_range.cpp @@ -5360,7 +5360,8 @@ int ObQueryRange::or_single_head_graphs(ObKeyPartList &or_list, query_range_ctx_->cur_expr_is_precise_ = false; } } - if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark()) { + if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark() && + cur1->item_next_ == NULL && cur2->item_next_ == NULL) { if (OB_FAIL(union_in_with_in(or_list, cur1, cur2, exec_ctx, @@ -5383,7 +5384,8 @@ int ObQueryRange::or_single_head_graphs(ObKeyPartList &or_list, } } bool need_remove_normal = false; - if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark()) { + if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark() && + cur1->item_next_ == NULL && cur2->item_next_ == NULL) { if (OB_FAIL(union_in_with_normal(cur1, cur2, exec_ctx, dtc_params, @@ -5409,7 +5411,8 @@ int ObQueryRange::or_single_head_graphs(ObKeyPartList &or_list, query_range_ctx_->cur_expr_is_precise_ = false; } } - if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark()) { + if (OB_SUCC(ret) && !cur1->is_question_mark() && !cur2->is_question_mark() && + cur1->item_next_ == NULL && cur2->item_next_ == NULL) { if (OB_FAIL(union_in_with_normal(cur2, cur1, exec_ctx, dtc_params, @@ -8273,7 +8276,7 @@ int ObQueryRange::is_strict_equal_graph( } else { // check align if (-1 == max_pos) { max_pos = next_pos - 1; - } else if (cur_pos != max_pos) { + } else if (next_pos - 1 != max_pos) { is_strict_equal = false; } }