Merge pull request #49873 from amosbird/fix_49839

Fix a bug with projections and the aggregate_functions_null_for_empty setting (for query_plan_optimize_projection)
This commit is contained in:
Anton Popov 2023-05-15 15:58:42 +02:00 committed by GitHub
commit 512b27ef27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -42,6 +42,10 @@ bool canUseProjectionForReadingStep(ReadFromMergeTree * reading)
if (reading->getContext()->getSettingsRef().allow_experimental_query_deduplication)
return false;
// Currently projection don't support settings which implicitly modify aggregate functions.
if (reading->getContext()->getSettingsRef().aggregate_functions_null_for_empty)
return false;
return true;
}

View File

@ -0,0 +1,8 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c0 Int32, PRIMARY KEY (c0)) ENGINE=MergeTree;
INSERT INTO t1 VALUES (1554690688);
SELECT MIN(t1.c0) FROM t1 SETTINGS aggregate_functions_null_for_empty = 1;
DROP TABLE IF EXISTS t1;