This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 3cd0d365994 [cherry-pick](branch-2.0) pick "[Enhancement](mor) Add
unique mor table min max push down case #32196" (#37599)
3cd0d365994 is described below
commit 3cd0d3659941047541acebf9370cd33bf818a13d
Author: abmdocrt <[email protected]>
AuthorDate: Sat Jul 13 22:09:57 2024 +0800
[cherry-pick](branch-2.0) pick "[Enhancement](mor) Add unique mor table min
max push down case #32196" (#37599)
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
---
.../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 2f364bf9bec..eaac687e2d5 100644
--- a/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
+++ b/regression-test/data/nereids_p0/explain/test_pushdown_explain.out
@@ -101,6 +101,80 @@ qdf
-- !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 ec8d9b5d8ae..ce74d60687c 100644
--- a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
+++ b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
@@ -183,6 +183,92 @@ suite("test_pushdown_explain") {
qt_select_16 "select max(username) 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]