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 66ed0934108 [test](Nereids): fix test push_down_top_n (#26937)
66ed0934108 is described below
commit 66ed0934108517c72235f3b5b83ec8302675c4ba
Author: jakevin <[email protected]>
AuthorDate: Thu Dec 7 23:07:32 2023 +0800
[test](Nereids): fix test push_down_top_n (#26937)
---
.../push_down_top_n_distinct_through_union.out | 48 +++++++++++-----------
.../push_down_top_n_through_union.out | 48 +++++++++++-----------
.../push_down_top_n_distinct_through_union.groovy | 33 ++++++---------
.../push_down_top_n_through_union.groovy | 31 +++++---------
4 files changed, 71 insertions(+), 89 deletions(-)
diff --git
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
index 02a947642c7..76b99a278f3 100644
---
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
+++
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
@@ -9,9 +9,9 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_conditions --
PhysicalResultSink
@@ -24,13 +24,13 @@ PhysicalResultSink
--------------PhysicalUnion
----------------PhysicalDistribute
------------------filter((t1.score > 10))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------filter((t2.name = 'Test'))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------filter((t3.id < 5))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_order_by --
PhysicalResultSink
@@ -42,11 +42,11 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_nested_union --
PhysicalResultSink
@@ -58,13 +58,13 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_after_join --
PhysicalResultSink
@@ -79,12 +79,12 @@ PhysicalResultSink
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id))
otherCondition=()
----------------------PhysicalProject
-------------------------PhysicalOlapScan[t]
+------------------------PhysicalOlapScan[table2]
----------------------PhysicalProject
-------------------------PhysicalOlapScan[t]
+------------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_different_projections --
PhysicalResultSink
@@ -97,10 +97,10 @@ PhysicalResultSink
--------------PhysicalUnion
----------------PhysicalDistribute
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_subquery --
PhysicalResultSink
@@ -113,11 +113,11 @@ PhysicalResultSink
--------------PhysicalUnion
----------------PhysicalDistribute
------------------PhysicalProject
---------------------filter((t.score > 20))
-----------------------PhysicalOlapScan[t]
+--------------------filter((table2.score > 20))
+----------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_limit --
PhysicalResultSink
@@ -132,12 +132,12 @@ PhysicalResultSink
------------------PhysicalLimit[GLOBAL]
--------------------PhysicalDistribute
----------------------PhysicalLimit[LOCAL]
-------------------------PhysicalOlapScan[t]
+------------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------PhysicalLimit[GLOBAL]
--------------------PhysicalDistribute
----------------------PhysicalLimit[LOCAL]
-------------------------PhysicalOlapScan[t]
+------------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_complex_conditions --
PhysicalResultSink
@@ -150,8 +150,8 @@ PhysicalResultSink
--------------PhysicalUnion
----------------PhysicalDistribute
------------------filter((t1.name = 'Test') and (t1.score > 10))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
----------------PhysicalDistribute
------------------filter((t2.id < 5) and (t2.score < 20))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table2]
diff --git
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.out
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.out
index 9c20ca80d59..57232fbf12d 100644
---
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.out
+++
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.out
@@ -9,12 +9,12 @@ PhysicalResultSink
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_with_conditions --
PhysicalResultSink
@@ -27,19 +27,19 @@ PhysicalResultSink
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------filter((t1.score > 10))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------filter((t2.name = 'Test'))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------filter((t3.id < 5))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_with_order_by --
PhysicalResultSink
@@ -51,17 +51,17 @@ PhysicalResultSink
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
-- !push_down_topn_nested_union --
PhysicalResultSink
@@ -73,22 +73,22 @@ PhysicalResultSink
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
-------------------PhysicalOlapScan[t]
+------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_after_join --
PhysicalResultSink
@@ -103,15 +103,15 @@ PhysicalResultSink
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id))
otherCondition=()
----------------------PhysicalProject
-------------------------PhysicalOlapScan[t] apply RFs: RF0
+------------------------PhysicalOlapScan[table1] apply RFs: RF0
----------------------PhysicalProject
-------------------------PhysicalOlapScan[t]
+------------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_different_projections --
PhysicalResultSink
@@ -124,13 +124,13 @@ PhysicalResultSink
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_with_subquery --
PhysicalResultSink
@@ -143,14 +143,14 @@ PhysicalResultSink
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------PhysicalProject
---------------------filter((t.score > 20))
-----------------------PhysicalOlapScan[t]
+--------------------filter((table1.score > 20))
+----------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------PhysicalProject
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_with_limit --
PhysicalResultSink
@@ -164,14 +164,14 @@ PhysicalResultSink
----------------PhysicalLimit[GLOBAL]
------------------PhysicalDistribute
--------------------PhysicalLimit[LOCAL]
-----------------------PhysicalOlapScan[t]
+----------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalTopN[LOCAL_SORT]
----------------PhysicalLimit[GLOBAL]
------------------PhysicalDistribute
--------------------PhysicalLimit[LOCAL]
-----------------------PhysicalOlapScan[t]
+----------------------PhysicalOlapScan[table1]
-- !push_down_topn_union_complex_conditions --
PhysicalResultSink
@@ -184,11 +184,11 @@ PhysicalResultSink
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------filter((t1.name = 'Test') and (t1.score > 10))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
----------PhysicalDistribute
------------PhysicalTopN[MERGE_SORT]
--------------PhysicalDistribute
----------------PhysicalTopN[LOCAL_SORT]
------------------filter((t2.id < 5) and (t2.score < 20))
---------------------PhysicalOlapScan[t]
+--------------------PhysicalOlapScan[table1]
diff --git
a/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.groovy
b/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.groovy
index 2d8af0ee7e2..0ed932c81d3 100644
---
a/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.groovy
+++
b/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.groovy
@@ -15,25 +15,16 @@
// specific language governing permissions and limitations
// under the License.
-suite("push_down_top_n_through_union") {
+suite("push_down_top_n_distinct_through_union") {
sql "SET enable_nereids_planner=true"
sql "SET enable_fallback_to_original_planner=false"
sql """
- DROP TABLE IF EXISTS t1;
- """
- sql """
- DROP TABLE IF EXISTS t2;
- """
- sql """
- DROP TABLE IF EXISTS t3;
- """
- sql """
- DROP TABLE IF EXISTS t4;
+ DROP TABLE IF EXISTS table2;
"""
sql """
- CREATE TABLE IF NOT EXISTS t(
+ CREATE TABLE IF NOT EXISTS table2(
`id` int(32) NULL,
`score` int(64) NULL,
`name` varchar(64) NULL
@@ -45,38 +36,38 @@ suite("push_down_top_n_through_union") {
"""
qt_push_down_topn_through_union """
- explain shape plan select * from (select * from t t1 union select *
from t t2) t order by id limit 10;
+ explain shape plan select * from (select * from table2 t1 union select
* from table2 t2) t order by id limit 10;
"""
qt_push_down_topn_union_with_conditions """
- explain shape plan select * from (select * from t t1 where t1.score >
10 union select * from t t2 where t2.name = 'Test' union select * from t t3
where t3.id < 5) sub order by id limit 10;
+ explain shape plan select * from (select * from table2 t1 where
t1.score > 10 union select * from table2 t2 where t2.name = 'Test' union select
* from table2 t3 where t3.id < 5) sub order by id limit 10;
"""
qt_push_down_topn_union_with_order_by """
- explain shape plan select * from (select * from t t1 union select *
from t t2 union select * from t t3 order by score) sub order by id limit 10;
+ explain shape plan select * from (select * from table2 t1 union select
* from table2 t2 union select * from table2 t3 order by score) sub order by id
limit 10;
"""
qt_push_down_topn_nested_union """
- explain shape plan select * from ((select * from t t1 union select *
from t t2) union (select * from t t3 union select * from t t4)) sub order by id
limit 10;
+ explain shape plan select * from ((select * from table2 t1 union
select * from table2 t2) union (select * from table2 t3 union select * from
table2 t4)) sub order by id limit 10;
"""
qt_push_down_topn_union_after_join """
- explain shape plan select * from (select t1.id from t t1 join t t2 on
t1.id = t2.id union select id from t t3) sub order by id limit 10;
+ explain shape plan select * from (select t1.id from table2 t1 join
table2 t2 on t1.id = t2.id union select id from table2 t3) sub order by id
limit 10;
"""
qt_push_down_topn_union_different_projections """
- explain shape plan select * from (select id from t t1 union select
name from t t2) sub order by id limit 10;
+ explain shape plan select * from (select id from table2 t1 union
select name from table2 t2) sub order by id limit 10;
"""
qt_push_down_topn_union_with_subquery """
- explain shape plan select * from (select id from (select * from t
where score > 20) t1 union select id from t t2) sub order by id limit 10;
+ explain shape plan select * from (select id from (select * from table2
where score > 20) t1 union select id from table2 t2) sub order by id limit 10;
"""
qt_push_down_topn_union_with_limit """
- explain shape plan select * from (select * from t t1 limit 5 union
select * from t t2 limit 5) sub order by id limit 10;
+ explain shape plan select * from (select * from table2 t1 limit 5
union select * from table2 t2 limit 5) sub order by id limit 10;
"""
qt_push_down_topn_union_complex_conditions """
- explain shape plan select * from (select * from t t1 where t1.score >
10 and t1.name = 'Test' union select * from t t2 where t2.id < 5 and t2.score <
20) sub order by id limit 10;
+ explain shape plan select * from (select * from table2 t1 where
t1.score > 10 and t1.name = 'Test' union select * from table2 t2 where t2.id <
5 and t2.score < 20) sub order by id limit 10;
"""
}
\ No newline at end of file
diff --git
a/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.groovy
b/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.groovy
index 336581e2322..9f19d7ac5db 100644
---
a/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.groovy
+++
b/regression-test/suites/nereids_rules_p0/push_down_top_n/push_down_top_n_through_union.groovy
@@ -20,20 +20,11 @@ suite("push_down_top_n_through_union") {
sql "SET enable_fallback_to_original_planner=false"
sql """
- DROP TABLE IF EXISTS t1;
- """
- sql """
- DROP TABLE IF EXISTS t2;
- """
- sql """
- DROP TABLE IF EXISTS t3;
- """
- sql """
- DROP TABLE IF EXISTS t4;
+ DROP TABLE IF EXISTS table1;
"""
sql """
- CREATE TABLE IF NOT EXISTS t(
+ CREATE TABLE IF NOT EXISTS table1(
`id` int(32) NULL,
`score` int(64) NULL,
`name` varchar(64) NULL
@@ -45,38 +36,38 @@ suite("push_down_top_n_through_union") {
"""
qt_push_down_topn_through_union """
- explain shape plan select * from (select * from t t1 union all select
* from t t2) t order by id limit 10;
+ explain shape plan select * from (select * from table1 t1 union all
select * from table1 t2) t order by id limit 10;
"""
qt_push_down_topn_union_with_conditions """
- explain shape plan select * from (select * from t t1 where t1.score >
10 union all select * from t t2 where t2.name = 'Test' union all select * from
t t3 where t3.id < 5) sub order by id limit 10;
+ explain shape plan select * from (select * from table1 t1 where
t1.score > 10 union all select * from table1 t2 where t2.name = 'Test' union
all select * from table1 t3 where t3.id < 5) sub order by id limit 10;
"""
qt_push_down_topn_union_with_order_by """
- explain shape plan select * from (select * from t t1 union all select
* from t t2 union all select * from t t3 order by score) sub order by id limit
10;
+ explain shape plan select * from (select * from table1 t1 union all
select * from table1 t2 union all select * from table1 t3 order by score) sub
order by id limit 10;
"""
qt_push_down_topn_nested_union """
- explain shape plan select * from ((select * from t t1 union all select
* from t t2) union all (select * from t t3 union all select * from t t4)) sub
order by id limit 10;
+ explain shape plan select * from ((select * from table1 t1 union all
select * from table1 t2) union all (select * from table1 t3 union all select *
from table1 t4)) sub order by id limit 10;
"""
qt_push_down_topn_union_after_join """
- explain shape plan select * from (select t1.id from t t1 join t t2 on
t1.id = t2.id union all select id from t t3) sub order by id limit 10;
+ explain shape plan select * from (select t1.id from table1 t1 join
table1 t2 on t1.id = t2.id union all select id from table1 t3) sub order by id
limit 10;
"""
qt_push_down_topn_union_different_projections """
- explain shape plan select * from (select id from t t1 union all select
name from t t2) sub order by id limit 10;
+ explain shape plan select * from (select id from table1 t1 union all
select name from table1 t2) sub order by id limit 10;
"""
qt_push_down_topn_union_with_subquery """
- explain shape plan select * from (select id from (select * from t
where score > 20) t1 union all select id from t t2) sub order by id limit 10;
+ explain shape plan select * from (select id from (select * from table1
where score > 20) t1 union all select id from table1 t2) sub order by id limit
10;
"""
qt_push_down_topn_union_with_limit """
- explain shape plan select * from (select * from t t1 limit 5 union all
select * from t t2 limit 5) sub order by id limit 10;
+ explain shape plan select * from (select * from table1 t1 limit 5
union all select * from table1 t2 limit 5) sub order by id limit 10;
"""
qt_push_down_topn_union_complex_conditions """
- explain shape plan select * from (select * from t t1 where t1.score >
10 and t1.name = 'Test' union all select * from t t2 where t2.id < 5 and
t2.score < 20) sub order by id limit 10;
+ explain shape plan select * from (select * from table1 t1 where
t1.score > 10 and t1.name = 'Test' union all select * from table1 t2 where
t2.id < 5 and t2.score < 20) sub order by id limit 10;
"""
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]