This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 69c62b6c6c [Fix](vectorization) fixed that when a column's 
_fixed_values exceeds the max_pushdown_conditions_per_column limit, the column 
will not perform predicate pushdown, but if there are subsequent columns that 
need to be pushed down, the subsequent column pushdown will be misplaced in 
_scan_keys and it causes query results to be wrong (#17405)
69c62b6c6c is described below

commit 69c62b6c6c444a0e9aba71e11206a572ef723020
Author: htyoung <[email protected]>
AuthorDate: Wed Mar 8 07:23:56 2023 +0800

    [Fix](vectorization) fixed that when a column's _fixed_values exceeds the 
max_pushdown_conditions_per_column limit, the column will not perform predicate 
pushdown, but if there are subsequent columns that need to be pushed down, the 
subsequent column pushdown will be misplaced in _scan_keys and it causes query 
results to be wrong (#17405)
    
    the max_pushdown_conditions_per_column limit, the column will not perform 
predicate pushdown, but if there are subsequent columns that need to be pushed 
down, the subsequent column pushdown will be misplaced in _scan_keys and it 
causes query results to be wrong
    Co-authored-by: tongyang.hty <[email protected]>
---
 be/src/vec/exec/scan/new_olap_scan_node.cpp        |  6 +++
 ...t_exceed_max_pushdown_conditions_per_column.out |  7 +++
 ...xceed_max_pushdown_conditions_per_column.groovy | 58 ++++++++++++++++++++++
 3 files changed, 71 insertions(+)

diff --git a/be/src/vec/exec/scan/new_olap_scan_node.cpp 
b/be/src/vec/exec/scan/new_olap_scan_node.cpp
index 4ad652f088..7367ab3fea 100644
--- a/be/src/vec/exec/scan/new_olap_scan_node.cpp
+++ b/be/src/vec/exec/scan/new_olap_scan_node.cpp
@@ -237,6 +237,12 @@ Status NewOlapScanNode::_build_key_ranges_and_filters() {
                             if (exact_range) {
                                 _colname_to_value_range.erase(iter->first);
                             }
+                        } else {
+                            // if exceed max_pushdown_conditions_per_column, 
use whole_value_rang instead
+                            // and will not erase from 
_colname_to_value_range, it must be not exact_range
+                            temp_range.set_whole_value_range();
+                            RETURN_IF_ERROR(_scan_keys.extend_scan_key(
+                                    temp_range, _max_scan_key_num, 
&exact_range, &eos));
                         }
                         return Status::OK();
                     },
diff --git 
a/regression-test/data/correctness/test_exceed_max_pushdown_conditions_per_column.out
 
b/regression-test/data/correctness/test_exceed_max_pushdown_conditions_per_column.out
new file mode 100644
index 0000000000..d6d1f38505
--- /dev/null
+++ 
b/regression-test/data/correctness/test_exceed_max_pushdown_conditions_per_column.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select1 --
+1      2
+
+-- !select2 --
+1      2
+
diff --git 
a/regression-test/suites/correctness/test_exceed_max_pushdown_conditions_per_column.groovy
 
b/regression-test/suites/correctness/test_exceed_max_pushdown_conditions_per_column.groovy
new file mode 100644
index 0000000000..e8e66eaf9a
--- /dev/null
+++ 
b/regression-test/suites/correctness/test_exceed_max_pushdown_conditions_per_column.groovy
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+/*
+How to produce the bug:
+when a column's _fixed_values exceeds the max_pushdown_conditions_per_column 
limit,
+the column will not perform predicate pushdown, but if there are subsequent 
columns 
+that need to be pushed down, the subsequent column pushdown will be misplaced 
in 
+_scan_keys and it causes query results to be wrong
+*/
+suite("test_exceed_max_pushdown_conditions_per_column") {
+    def tableName = 
"exceed_max_pushdown_conditions_per_column_limit_test_table";
+    sql """ DROP TABLE IF EXISTS ${tableName}; """
+    sql """
+        create table if not exists ${tableName}(
+            id1 int comment 'id1'
+            ,id2 int comment 'id2'
+        ) ENGINE=OLAP
+        UNIQUE KEY(id1,id2)
+        COMMENT '超过max_pushdown_conditions_per_column测试'
+        DISTRIBUTED BY HASH(id1,id2) BUCKETS 1
+        PROPERTIES("replication_num" = "1")
+        ;
+    """
+    sql """
+        insert into ${tableName}(id1,id2) values(1,2);
+    """
+    sql """
+        set max_pushdown_conditions_per_column = 10;
+    """
+    qt_select1 """
+        select * from ${tableName} where id1 in
+        (1,2,3,4,5,6,7,8,9,10)
+        and id2=2;
+    """
+    qt_select2 """
+        select * from ${tableName} where id1 in
+        (1,2,3,4,5,6,7,8,9,10,11)
+        and id2=2;
+    """
+    sql "DROP TABLE IF EXISTS ${tableName};"
+}
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to