From c36b44c0dae3c67d7ebdc9141b8c347e40d20131 Mon Sep 17 00:00:00 2001 From: zhangstar333 <2561612514@qq.com> Date: Fri, 17 Nov 2023 18:14:08 +0800 Subject: [PATCH] update --- .../rewrite/CountLiteralToCountStar.java | 2 +- .../explain/test_pushdown_explain.groovy | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CountLiteralToCountStar.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CountLiteralToCountStar.java index d50d8b5a8e4449..fc08273b84f4c3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CountLiteralToCountStar.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CountLiteralToCountStar.java @@ -57,7 +57,7 @@ private boolean rewriteCountLiteral(List oldExprs, List replaced.put(c, new Count())); expr = expr.rewriteUp(s -> replaced.getOrDefault(s, s)); - changed = !replaced.isEmpty(); + changed |= !replaced.isEmpty(); newExprs.add((NamedExpression) expr); } return changed; 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 c7fe7d7b93eda0..e82b524b5a2307 100644 --- a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy +++ b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy @@ -25,4 +25,44 @@ suite("test_pushdown_explain") { contains "PREDICATES:" } qt_select "select k1 from baseall where k1 = 1" + + sql "DROP TABLE IF EXISTS test_lineorder" + sql """ CREATE TABLE `test_lineorder` ( + `lo_orderkey` INT NOT NULL COMMENT '\"\"', + `lo_linenumber` INT NOT NULL COMMENT '\"\"', + `lo_shipmode` VARCHAR(11) NOT NULL COMMENT '\"\"' + ) ENGINE=OLAP + DUPLICATE KEY(`lo_orderkey`) + DISTRIBUTED BY HASH(`lo_orderkey`) BUCKETS 48 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "min_load_replica_num" = "-1", + "is_being_synced" = "false", + "colocate_with" = "groupa1", + "storage_format" = "V2", + "light_schema_change" = "true", + "disable_auto_compaction" = "false", + "enable_single_replica_compaction" = "false" + ); """ + sql """ insert into test_lineorder values(1,2,"asd"); """ + explain { + sql("select count(1) from test_lineorder;") + contains "pushAggOp=COUNT" + } + explain { + sql("select count(*) from test_lineorder;") + contains "pushAggOp=COUNT" + } + explain { + sql("select count(1) - count(lo_shipmode) from test_lineorder;") + contains "pushAggOp=COUNT" + } + explain { + sql("select count(lo_orderkey) from test_lineorder;") + contains "pushAggOp=COUNT" + } + explain { + sql("select count(cast(lo_orderkey as bigint)) from test_lineorder;") + contains "pushAggOp=COUNT" + } }