Skip to content

Commit

Permalink
Merge pull request #28560 from amosbird/projection-fix15
Browse files Browse the repository at this point in the history
Fix wrong header of minmax_count projection
  • Loading branch information
KochetovNicolai authored Sep 6, 2021
2 parents 4780008 + bb87d01 commit 2178ed2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read(
if (query_info.projection->desc->is_minmax_count_projection)
{
Pipe pipe(std::make_shared<SourceFromSingleChunk>(
query_info.minmax_count_projection_block,
query_info.minmax_count_projection_block.cloneEmpty(),
Chunk(query_info.minmax_count_projection_block.getColumns(), query_info.minmax_count_projection_block.rows())));
auto read_from_pipe = std::make_unique<ReadFromPreparedSource>(std::move(pipe));
projection_plan->addStep(std::move(read_from_pipe));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
0 9998 5000
1 9999 5000
0 9998 5000
1
3 changes: 3 additions & 0 deletions tests/queries/0_stateless/01710_minmax_count_projection.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ select min(i), max(i), count() from d group by _partition_id order by _partition
select min(i), max(i), count() from d where _partition_value.1 = 0 group by _partition_id order by _partition_id;
select min(i), max(i), count() from d where _partition_value.1 = 10 group by _partition_id order by _partition_id;

-- fuzz crash
select min(i) from d where 1 = _partition_value.1;

drop table d;

0 comments on commit 2178ed2

Please sign in to comment.