From d05f430ca207dbdfa9cecff319a8751496df0e25 Mon Sep 17 00:00:00 2001 From: minghong Date: Wed, 28 Dec 2022 11:09:56 +0800 Subject: [PATCH] [feature](nereids) support syntax: count(all *) (#15376) --- .../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 | 2 +- .../data/nereids_syntax_p0/aggregate_strategies.out | 6 ++++++ .../suites/nereids_syntax_p0/aggregate_strategies.groovy | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 index c48294225f..8dbd7dd23b 100644 --- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 +++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 @@ -296,7 +296,7 @@ primaryExpression | constant #constantDefault | ASTERISK #star | qualifiedName DOT ASTERISK #star - | identifier LEFT_PAREN (DISTINCT? arguments+=expression + | identifier LEFT_PAREN ((DISTINCT|ALL)? arguments+=expression (COMMA arguments+=expression)*)? RIGHT_PAREN #functionCall | LEFT_PAREN query RIGHT_PAREN #subqueryExpression | identifier #columnReference diff --git a/regression-test/data/nereids_syntax_p0/aggregate_strategies.out b/regression-test/data/nereids_syntax_p0/aggregate_strategies.out index 5c8d99b8c3..4e0c274447 100644 --- a/regression-test/data/nereids_syntax_p0/aggregate_strategies.out +++ b/regression-test/data/nereids_syntax_p0/aggregate_strategies.out @@ -2,6 +2,9 @@ -- !count_all -- 10 +-- !count_all -- +10 + -- !count_all_group_by -- 2 2 @@ -120,6 +123,9 @@ name_4 1 4 -- !count_all -- 10 +-- !count_all -- +10 + -- !count_all_group_by -- 2 2 diff --git a/regression-test/suites/nereids_syntax_p0/aggregate_strategies.groovy b/regression-test/suites/nereids_syntax_p0/aggregate_strategies.groovy index 977c51f0e4..65aa1fe838 100644 --- a/regression-test/suites/nereids_syntax_p0/aggregate_strategies.groovy +++ b/regression-test/suites/nereids_syntax_p0/aggregate_strategies.groovy @@ -45,6 +45,7 @@ suite("aggregate_strategies") { sql "SET enable_nereids_planner=true" sql "SET enable_fallback_to_original_planner=false" + order_qt_count_all "select count(ALL *) from $tableName" order_qt_count_all "select count(*) from $tableName" order_qt_count_all_group_by "select count(*) from $tableName group by id" order_qt_count_all_group_by_2 "select count(*) from $tableName group by id, name"