Try fix aggregating.

This commit is contained in:
Nikolai Kochetov 2020-04-04 18:37:31 +03:00
parent 36604e93ce
commit bcebad1d60
2 changed files with 9 additions and 2 deletions

View File

@ -185,7 +185,7 @@ void AggregatingSortedTransform::merge()
if (key_differs)
{
/// Write the simple aggregation result for the previous group.
if (merged_data.mergedRows() > 0)
if (merged_data.isGroupStarted())
{
insertSimpleAggregationResult();
merged_data.insertRow();
@ -227,7 +227,7 @@ void AggregatingSortedTransform::merge()
}
/// Write the simple aggregation result for the previous group.
if (merged_data.mergedRows() > 0)
if (merged_data.isGroupStarted())
{
insertSimpleAggregationResult();
merged_data.insertRow();

View File

@ -63,10 +63,15 @@ private:
{
for (auto column_number : column_numbers)
columns[column_number]->insertFrom(*raw_columns[column_number], row);
is_group_started = true;
}
bool isGroupStarted() const { return is_group_started; }
void insertRow()
{
is_group_started = false;
++total_merged_rows;
++merged_rows;
/// TODO: sum_blocks_granularity += block_size;
@ -81,6 +86,8 @@ private:
for (auto & desc : def.columns_to_aggregate)
desc.column = typeid_cast<ColumnAggregateFunction *>(columns[desc.column_number].get());
}
private:
bool is_group_started = false;
};
ColumnsDefinition columns_definition;