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 7d778e035d0 [Enhancement](mor) Add unique mor table min max push down
case #32196
7d778e035d0 is described below
commit 7d778e035d0a5c943693c835606fe1c97ea92857
Author: abmdocrt <[email protected]>
AuthorDate: Thu Mar 14 09:28:37 2024 +0800
[Enhancement](mor) Add unique mor table min max push down case #32196
---
.../nereids_p0/explain/test_pushdown_explain.out | 74 +++++++++++++++++++
.../explain/test_pushdown_explain.groovy | 86 ++++++++++++++++++++++
2 files changed, 160 insertions(+)
diff --git a/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
b/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
index a5fa13665d0..b970ec274ec 100644
--- a/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
+++ b/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
@@ -104,6 +104,80 @@ ll
-- !select_18 --
zzz
+-- !select_mor_0 --
+1 asd cc
+2 qwe vvx
+3 ffsd mnm
+4 qdf ll
+5 cvfv vff
+
+-- !select_mor_1 --
+1
+
+-- !select_mor_2 --
+5
+
+-- !select_mor_3 --
+asd
+
+-- !select_mor_4 --
+qwe
+
+-- !select_mor_5 --
+cc
+
+-- !select_mor_6 --
+vvx
+
+-- !select_mor_00 --
+1 asd zzz
+2 qwe vvx
+3 ffsd mnm
+4 qdf ll
+5 cvfv vff
+
+-- !select_mor_7 --
+1
+
+-- !select_mor_8 --
+5
+
+-- !select_mor_9 --
+asd
+
+-- !select_mor_10 --
+qwe
+
+-- !select_mor_11 --
+cc
+
+-- !select_mor_12 --
+zzz
+
+-- !select_mor_000 --
+1 asd zzz
+3 ffsd mnm
+4 qdf ll
+5 cvfv vff
+
+-- !select_mor_13 --
+1
+
+-- !select_mor_14 --
+5
+
+-- !select_mor_15 --
+asd
+
+-- !select_mor_16 --
+qdf
+
+-- !select_mor_17 --
+cc
+
+-- !select_mor_18 --
+zzz
+
-- !select_19 --
1
diff --git
a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
index 8406e0972bc..f7360963e55 100644
--- a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
+++ b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
@@ -191,6 +191,92 @@ suite("test_pushdown_explain") {
qt_select_17 "select min(val) from table_unique;"
qt_select_18 "select max(val) from table_unique;"
+ sql "DROP TABLE IF EXISTS table_unique11"
+ sql """
+ CREATE TABLE `table_unique11` (
+ `user_id` LARGEINT NOT NULL COMMENT '\"用户id\"',
+ `username` VARCHAR(50) NOT NULL COMMENT '\"用户昵称\"',
+ `val` VARCHAR(50) NULL
+ ) ENGINE=OLAP
+ UNIQUE KEY(`user_id`, `username`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "disable_auto_compaction" = "true",
+ "enable_unique_key_merge_on_write" = "false"
+ );
+ """
+ sql """
+ insert into table_unique11
values(1,"asd","cc"),(2,"qwe","vvx"),(3,"ffsd","mnm"),(4,"qdf","ll"),(5,"cvfv","vff");
+ """
+
+ sql "set enable_pushdown_minmax_on_unique = false;"
+ explain {
+ sql("select min(user_id) from table_unique11;")
+ contains "pushAggOp=NONE"
+ }
+ explain {
+ sql("select max(user_id) from table_unique11;")
+ contains "pushAggOp=NONE"
+ }
+ explain {
+ sql("select min(username) from table_unique11;")
+ contains "pushAggOp=NONE"
+ }
+ explain {
+ sql("select max(username) from table_unique11;")
+ contains "pushAggOp=NONE"
+ }
+
+
+ // set seession variables
+ sql "set enable_pushdown_minmax_on_unique = true;"
+ explain {
+ sql("select min(user_id) from table_unique11;")
+ contains "pushAggOp=MINMAX"
+ }
+ explain {
+ sql("select max(user_id) from table_unique11;")
+ contains "pushAggOp=MINMAX"
+ }
+ explain {
+ sql("select min(username) from table_unique11;")
+ contains "pushAggOp=MINMAX"
+ }
+ explain {
+ sql("select max(username) from table_unique11;")
+ contains "pushAggOp=MINMAX"
+ }
+ qt_select_mor_0 "select * from table_unique11 order by user_id;"
+ qt_select_mor_1 "select min(user_id) from table_unique11;"
+ qt_select_mor_2 "select max(user_id) from table_unique11;"
+ qt_select_mor_3 "select min(username) from table_unique11;"
+ qt_select_mor_4 "select max(username) from table_unique11;"
+ qt_select_mor_5 "select min(val) from table_unique11;"
+ qt_select_mor_6 "select max(val) from table_unique11;"
+ sql """
+ update table_unique11 set val = "zzz" where user_id = 1;
+ """
+ qt_select_mor_00 "select * from table_unique11 order by user_id;"
+ qt_select_mor_7 "select min(user_id) from table_unique11;"
+ qt_select_mor_8 "select max(user_id) from table_unique11;"
+ qt_select_mor_9 "select min(username) from table_unique11;"
+ qt_select_mor_10 "select max(username) from table_unique11;"
+ qt_select_mor_11 "select min(val) from table_unique11;"
+ qt_select_mor_12 "select max(val) from table_unique11;"
+
+ sql """
+ delete from table_unique11 where user_id = 2;
+ """
+ qt_select_mor_000 "select * from table_unique11 order by user_id;"
+ qt_select_mor_13 "select min(user_id) from table_unique11;"
+ qt_select_mor_14 "select max(user_id) from table_unique11;"
+ qt_select_mor_15 "select min(username) from table_unique11;"
+ qt_select_mor_16 "select max(username) from table_unique11;"
+ qt_select_mor_17 "select min(val) from table_unique11;"
+ qt_select_mor_18 "select max(val) from table_unique11;"
+
sql "DROP TABLE IF EXISTS table_agg"
sql """
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]