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

jakevin 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 f4803e6602e [test](Nereids): add push_down_distinct_through_join 
regression test (#30760)
f4803e6602e is described below

commit f4803e6602ed6afa144afcbb0282f7f4fadbb976
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Fri Feb 2 23:04:22 2024 +0800

    [test](Nereids): add push_down_distinct_through_join regression test 
(#30760)
---
 .../push_down_distinct_through_join.out            | 42 +++++++++++++
 .../push_down_distinct_through_join.groovy         | 70 ++++++++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git 
a/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
 
b/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
new file mode 100644
index 00000000000..1e6ea0878c7
--- /dev/null
+++ 
b/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
@@ -0,0 +1,42 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !basic_not --
+PhysicalResultSink
+--hashAgg[LOCAL]
+----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
+------PhysicalOlapScan[t]
+------PhysicalOlapScan[t]
+
+-- !basic --
+PhysicalResultSink
+--hashAgg[LOCAL]
+----hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=()
+------hashAgg[LOCAL]
+--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
+----------PhysicalOlapScan[t]
+----------PhysicalOlapScan[t]
+------PhysicalOlapScan[t]
+
+-- !basic_sql --
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+
+-- !basic_sql_disable --
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+
diff --git 
a/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy
 
b/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy
new file mode 100644
index 00000000000..1903f99e7a2
--- /dev/null
+++ 
b/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy
@@ -0,0 +1,70 @@
+// 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("push_down_distinct_through_join") {
+    sql "SET enable_nereids_planner=true"
+    sql "set runtime_filter_mode=OFF"
+    sql "SET enable_fallback_to_original_planner=false"
+    sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'"
+    sql "SET disable_join_reorder=true"
+
+    sql """
+        DROP TABLE IF EXISTS t;
+    """
+
+    sql """
+    CREATE TABLE IF NOT EXISTS t(
+      `id` int(32),
+      `score` int(64) NULL,
+      `name` varchar(64) NULL
+    ) ENGINE = OLAP
+    DISTRIBUTED BY HASH(id) BUCKETS 4
+    PROPERTIES (
+      "replication_allocation" = "tag.location.default: 1"
+    );
+    """
+
+    sql "insert into t values (1, 1, 'a')"
+    sql "insert into t values (2, null, 'a')"
+    sql "insert into t values (3, 1, null)"
+    sql "insert into t values (4, 2, 'b')"
+    sql "insert into t values (5, null, 'b')"
+    sql "insert into t values (6, 2, null)"
+    sql "insert into t values (7, 3, 'c')"
+    sql "insert into t values (8, null, 'c')"
+    sql "insert into t values (9, 3, null)"
+    sql "insert into t values (10, null, null)"
+
+    sql "SET ENABLE_NEREIDS_RULES=push_down_distinct_through_join"
+
+    qt_basic_not """
+        explain shape plan select distinct * from (select t1.id from t t1 join 
t t2 on t1.id = t2.id) t;
+    """
+
+    qt_basic """
+        explain shape plan select distinct * from (select t1.id from t t1 join 
t t2 on t1.id = t2.id join t t3 on t1.id = t3.id) t;
+    """
+
+    order_qt_basic_sql """
+        select distinct * from (select t1.id from t t1 join t t2 on t1.id = 
t2.id join t t3 on t1.id = t3.id) t;
+    """
+
+    sql "SET ENABLE_NEREIDS_RULES=''"
+    order_qt_basic_sql_disable """
+        select distinct * from (select t1.id from t t1 join t t2 on t1.id = 
t2.id join t t3 on t1.id = t3.id) t;
+    """
+}
\ 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