1#include <Processors/Transforms/ReverseTransform.h>
2#include <Common/PODArray.h>
3
4namespace DB
5{
6
7void ReverseTransform::transform(Chunk & chunk)
8{
9 IColumn::Permutation permutation;
10
11 size_t num_rows = chunk.getNumRows();
12 for (size_t i = 0; i < num_rows; ++i)
13 permutation.emplace_back(num_rows - 1 - i);
14
15 auto columns = chunk.detachColumns();
16
17 for (auto & column : columns)
18 column = column->permute(permutation, 0);
19
20 chunk.setColumns(std::move(columns), num_rows);
21}
22
23}
24