Merge pull request #39155 from amosbird/trivial-count-empty-set

Fix trivial count with empty set
This commit is contained in:
Vladimir C 2022-07-13 12:53:14 +02:00 committed by GitHub
commit d376a4b593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -1933,6 +1933,7 @@ void InterpreterSelectQuery::executeFetchColumns(QueryProcessingStage::Enum proc
syntax_analyzer_result->optimize_trivial_count
&& (settings.max_parallel_replicas <= 1)
&& !settings.allow_experimental_query_deduplication
&& !settings.empty_result_for_aggregation_by_empty_set
&& storage
&& storage->getName() != "MaterializedMySQL"
&& !row_policy_filter

View File

@ -0,0 +1,9 @@
drop table if exists test;
create table test(a Int64) Engine=MergeTree order by tuple();
set optimize_trivial_count_query=1, empty_result_for_aggregation_by_empty_set=1;
select count() from test;
drop table test;