aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/GatherUtils/push.cpp
blob: c4b79948fa0ff72cfa8e389d11fd6302aad36903 (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
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"

namespace DB::GatherUtils
{

namespace
{

struct ArrayPush : public ArrayAndValueSourceSelectorBySink<ArrayPush>
{
    template <typename ArraySource, typename ValueSource, typename Sink>
    static void selectArrayAndValueSourceBySink(
            ArraySource && array_source, ValueSource && value_source, Sink && sink, bool push_front)
    {
        if (push_front)
            concat(value_source, array_source, sink);
        else
            concat(array_source, value_source, sink);
    }
};

}

void push(IArraySource & array_source, IValueSource & value_source, IArraySink & sink, bool push_front)
{
    ArrayPush::select(sink, array_source, value_source, push_front);
}
}