| 1 | #include <Processors/Transforms/MaterializingTransform.h> |
|---|---|
| 2 | #include <DataStreams/materializeBlock.h> |
| 3 | |
| 4 | namespace DB |
| 5 | { |
| 6 | |
| 7 | MaterializingTransform::MaterializingTransform(const Block & header) |
| 8 | : ISimpleTransform(header, materializeBlock(header), false) {} |
| 9 | |
| 10 | void MaterializingTransform::transform(Chunk & chunk) |
| 11 | { |
| 12 | auto num_rows = chunk.getNumRows(); |
| 13 | auto columns = chunk.detachColumns(); |
| 14 | |
| 15 | for (auto & col : columns) |
| 16 | col = col->convertToFullColumnIfConst(); |
| 17 | |
| 18 | chunk.setColumns(std::move(columns), num_rows); |
| 19 | } |
| 20 | |
| 21 | } |
| 22 |