Improve implementation of sumMap for tuples

This commit is contained in:
Ildus Kurbangaliev 2020-04-16 17:26:17 +00:00
parent fcacca68d7
commit 602baf62f0

View File

@ -81,17 +81,16 @@ public:
void add(AggregateDataPtr place, const IColumn ** columns, const size_t row_num, Arena *) const override
{
// Check if tuple
std::unique_ptr<const IColumn *[]> tuple_columns;
auto tuple_col = checkAndGetColumn<ColumnTuple>(columns[0]);
if (tuple_col)
{
tuple_columns.reset(new const IColumn*[tuple_col->tupleSize()]);
for (size_t i = 0; i < tuple_col->tupleSize(); i++)
tuple_columns.get()[i] = &const_cast<IColumn&>(tuple_col->getColumn(i));
columns = tuple_columns.get();
addImpl(place, tuple_col->getColumns(), row_num);
else
addImpl(place, columns, row_num);
}
template<typename TColumns>
void addImpl(AggregateDataPtr place, TColumns & columns, const size_t row_num) const
{
// Column 0 contains array of keys of known type
Field key_field;
const ColumnArray & array_column0 = assert_cast<const ColumnArray &>(*columns[0]);