1 | #include <DataStreams/finalizeBlock.h> |
---|---|
2 | #include <DataTypes/DataTypeAggregateFunction.h> |
3 | #include <Columns/ColumnAggregateFunction.h> |
4 | #include <Common/typeid_cast.h> |
5 | |
6 | |
7 | namespace DB |
8 | { |
9 | void finalizeBlock(Block & block) |
10 | { |
11 | for (size_t i = 0; i < block.columns(); ++i) |
12 | { |
13 | ColumnWithTypeAndName & current = block.getByPosition(i); |
14 | const DataTypeAggregateFunction * unfinalized_type = typeid_cast<const DataTypeAggregateFunction *>(current.type.get()); |
15 | |
16 | if (unfinalized_type) |
17 | { |
18 | current.type = unfinalized_type->getReturnType(); |
19 | if (current.column) |
20 | current.column = typeid_cast<const ColumnAggregateFunction &>(*current.column).convertToValues(); |
21 | } |
22 | } |
23 | } |
24 | } |
25 |