Skip to content

Commit

Permalink
Merge pull request #42298 from ClickHouse/backport/22.3/42198
Browse files Browse the repository at this point in the history
Backport #42198 to 22.3: Fix a bug with projections and the `aggregate_functions_null_for_empty` setting
  • Loading branch information
alexey-milovidov committed Oct 14, 2022
2 parents e2ef836 + 62323e1 commit 747b3bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Storages/MergeTree/MergeTreeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4746,7 +4746,8 @@ std::optional<ProjectionCandidate> MergeTreeData::getQueryProcessingStageWithAgg
{
const auto & metadata_snapshot = storage_snapshot->metadata;
const auto & settings = query_context->getSettingsRef();
if (!settings.allow_experimental_projection_optimization || query_info.ignore_projections || query_info.is_projection_query)
if (!settings.allow_experimental_projection_optimization || query_info.ignore_projections || query_info.is_projection_query
|| settings.aggregate_functions_null_for_empty /* projections don't work correctly with this setting */)
return std::nullopt;

// Currently projections don't support parallel replicas reading yet.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20220920
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Tags: no-fasttest
# Tag no-fasttest: depends on bzip2

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh

${CLICKHOUSE_LOCAL} --aggregate_functions_null_for_empty=1 --multiquery --query "create table test_date (date Int32) ENGINE = MergeTree ORDER BY (date) as select 20220920; SELECT max(date) FROM test_date";

0 comments on commit 747b3bc

Please sign in to comment.