Skip to content

Commit

Permalink
fix aggregate all key is null error
Browse files Browse the repository at this point in the history
  • Loading branch information
liuneng1994 committed Apr 25, 2023
1 parent 8ea193e commit 52be833
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Interpreters/Aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,8 @@ Aggregator::convertToBlockImplNotFinal(Method & method, Table & data, Arenas & a
std::optional<OutputBlockColumns> out_cols;
std::optional<Sizes> shuffled_key_sizes;

size_t rows_in_current_block = 0;

auto init_out_cols = [&]()
{
out_cols = prepareOutputBlockColumns(params, aggregate_functions, getHeader(final), aggregates_pools, final, max_block_size);
Expand All @@ -2115,6 +2117,8 @@ Aggregator::convertToBlockImplNotFinal(Method & method, Table & data, Arenas & a
for (size_t i = 0; i < params.aggregates_size; ++i)
out_cols->aggregate_columns_data[i]->push_back(data.getNullKeyData() + offsets_of_aggregate_states[i]);

++rows_in_current_block;

data.getNullKeyData() = nullptr;
data.hasNullKeyData() = false;
}
Expand All @@ -2126,7 +2130,6 @@ Aggregator::convertToBlockImplNotFinal(Method & method, Table & data, Arenas & a
// should be invoked at least once, because null data might be the only content of the `data`
init_out_cols();

size_t rows_in_current_block = 0;

data.forEachValue(
[&](const auto & key, auto & mapped)
Expand Down

0 comments on commit 52be833

Please sign in to comment.