Support countState(*)

This commit is contained in:
Amos Bird 2022-10-01 14:59:26 +08:00
parent 036d1c8cbc
commit 98fc22b08e
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 13 additions and 1 deletions

View File

@ -149,7 +149,7 @@ void TranslateQualifiedNamesMatcher::visit(ASTFunction & node, const ASTPtr &, D
if (!func_arguments) return;
String func_name_lowercase = Poco::toLower(node.name);
if (func_name_lowercase == "count" &&
if ((func_name_lowercase == "count" || func_name_lowercase == "countstate") &&
func_arguments->children.size() == 1 &&
func_arguments->children[0]->as<ASTAsterisk>())
func_arguments->children.clear();

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,11 @@
drop table if exists a;
drop table if exists b;
create table a (i int, j int) engine Log;
create materialized view b engine Log as select countState(*) from a;
insert into a values (1, 2);
select countMerge(*) from b;
drop table b;
drop table a;