aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Transforms/ArrayJoinTransform.cpp
blob: d9c940b8b0534013c02ebff5e04d2f266f3d9c39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Processors/Transforms/ArrayJoinTransform.h>
#include <Interpreters/ArrayJoinAction.h>

namespace DB
{

Block ArrayJoinTransform::transformHeader(Block header, const ArrayJoinActionPtr & array_join)
{
    array_join->execute(header);
    return header;
}

ArrayJoinTransform::ArrayJoinTransform(
    const Block & header_,
    ArrayJoinActionPtr array_join_,
    bool /*on_totals_*/)
    : ISimpleTransform(header_, transformHeader(header_, array_join_), false)
    , array_join(std::move(array_join_))
{
    /// TODO
//    if (on_totals_)
//        throw Exception(ErrorCodes::LOGICAL_ERROR, "ARRAY JOIN is not supported for totals");
}

void ArrayJoinTransform::transform(Chunk & chunk)
{
    auto block = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns());
    array_join->execute(block);
    chunk.setColumns(block.getColumns(), block.rows());
}

}