Skip to content

Commit

Permalink
Fix a bug with projections and the aggregate_functions_null_for_empty
Browse files Browse the repository at this point in the history
setting (for query_plan_optimize_projection)

Fix a bug with projections and the aggregate_functions_null_for_empty
setting. This was already fixed in PR ClickHouse#42198 but got forgotten after
using query_plan_optimize_projection.
  • Loading branch information
amosbird committed May 15, 2023
1 parent bec4eda commit 4764259
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Processors/QueryPlan/Optimizations/projectionsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1554690688
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 4764259

Please sign in to comment.