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

eldenmoon pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 38d750a7e02 [Fix](Row Store) all filter should match key columns 
condition (#36400) (#36443)
38d750a7e02 is described below

commit 38d750a7e0235e5ad8d20bfe16649cde7304e1eb
Author: lihangyu <15605149...@163.com>
AuthorDate: Wed Jun 19 14:06:53 2024 +0800

    [Fix](Row Store) all filter should match key columns condition (#36400) 
(#36443)
    
    Queries like `select * from tbl` will pass
    `LogicalResultSinkToShortCircuitPointQuery` rule in the previous.
    Introduced by #35823
---
 .../LogicalResultSinkToShortCircuitPointQuery.java |  5 ++-
 .../data/point_query_p0/test_rowstore_query.out    |  7 ++++
 .../point_query_p0/test_rowstore_query.groovy      | 43 ++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java
index 1438edb9bdd..d856b9599cb 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java
@@ -74,7 +74,10 @@ public class LogicalResultSinkToShortCircuitPointQuery 
implements RewriteRuleFac
         // All key columns in conjuncts
         Set<String> colNames = Sets.newHashSet();
         for (Expression expr : conjuncts) {
-            colNames.add(((SlotReference) 
removeCast((expr.child(0)))).getName());
+            SlotReference slot = ((SlotReference) removeCast((expr.child(0))));
+            if (slot.isKeyColumnFromTable()) {
+                colNames.add(slot.getName());
+            }
         }
         // set short circuit flag and modify nothing to the plan
         if (olapTable.getBaseSchemaKeyColumns().size() <= colNames.size()) {
diff --git a/regression-test/data/point_query_p0/test_rowstore_query.out 
b/regression-test/data/point_query_p0/test_rowstore_query.out
new file mode 100644
index 00000000000..b43e0263960
--- /dev/null
+++ b/regression-test/data/point_query_p0/test_rowstore_query.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+1      abc     1111919.123456789190000000
+
+-- !sql --
+2      def     1111919.123456789190000000
+
diff --git a/regression-test/suites/point_query_p0/test_rowstore_query.groovy 
b/regression-test/suites/point_query_p0/test_rowstore_query.groovy
new file mode 100644
index 00000000000..db5f74f3f61
--- /dev/null
+++ b/regression-test/suites/point_query_p0/test_rowstore_query.groovy
@@ -0,0 +1,43 @@
+// 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.
+
+suite("test_rowstore", "p0") {
+    def tableName = "rs_query_2"
+    sql """DROP TABLE IF EXISTS ${tableName}"""
+    sql "set enable_decimal256 = true"
+    sql """
+              CREATE TABLE IF NOT EXISTS ${tableName} (
+                `k1` int(11) NULL COMMENT "",
+                `v1` text NULL COMMENT "",
+                `v2` DECIMAL(50, 18) NULL COMMENT ""
+              ) ENGINE=OLAP
+              UNIQUE KEY(`k1`)
+              DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+              PROPERTIES (
+              "replication_allocation" = "tag.location.default: 1",
+              "store_row_column" = "true",
+              "enable_unique_key_merge_on_write" = "true",
+              "light_schema_change" = "true",
+              "storage_format" = "V2"
+              )
+          """
+
+    sql """insert into ${tableName} values (1, 'abc', 1111919.12345678919)"""
+    qt_sql """select * from ${tableName}"""
+    sql """insert into ${tableName} values (2, 'def', 1111919.12345678919)"""
+    qt_sql """select * from ${tableName} where k1 = 2"""
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to