Fix aggregator when data is empty

This commit is contained in:
Antonio Andelic 2024-03-20 14:50:26 +01:00
parent a1c08b256a
commit 9bf50ac814
3 changed files with 9 additions and 1 deletions

View File

@ -1867,7 +1867,12 @@ Aggregator::convertToBlockImpl(Method & method, Table & data, Arena * arena, Are
if (data.empty())
{
auto && out_cols = prepareOutputBlockColumns(params, aggregate_functions, getHeader(final), aggregates_pools, final, rows);
return {finalizeBlock(params, getHeader(final), std::move(out_cols), final, rows)};
auto finalized_block = finalizeBlock(params, getHeader(final), std::move(out_cols), final, rows);
if (return_single_block)
return std::move(finalized_block);
return BlocksList{std::move(finalized_block)};
}
ConvertToBlockResVariant res;
bool use_compiled_functions = false;

View File

@ -0,0 +1,3 @@
CREATE TABLE 03015_aggregator_empty_data_multiple_blocks (c0 Int32) ENGINE = Memory();
INSERT INTO 03015_aggregator_empty_data_multiple_blocks SELECT * FROM generateRandom() LIMIT 1000;
SELECT radians(t1.c0) FROM 03015_aggregator_empty_data_multiple_blocks AS t1 RIGHT ANTI JOIN 03015_aggregator_empty_data_multiple_blocks AS right_0 ON t1.c0=right_0.c0 GROUP BY t1.c0;