aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Sinks/RemoteSink.h
blob: 30cf958c0722dfe16d3e73d9f56dea52e0fa14ce (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
#pragma once
#include <Processors/Sinks/SinkToStorage.h>
#include <QueryPipeline/RemoteInserter.h>

namespace DB
{

class RemoteSink final : public RemoteInserter, public SinkToStorage
{
public:
    explicit RemoteSink(
        Connection & connection_,
        const ConnectionTimeouts & timeouts,
        const String & query_,
        const Settings & settings_,
        const ClientInfo & client_info_)
      : RemoteInserter(connection_, timeouts, query_, settings_, client_info_)
      , SinkToStorage(RemoteInserter::getHeader())
    {
    }

    String getName() const override { return "RemoteSink"; }
    void consume (Chunk chunk) override { write(RemoteInserter::getHeader().cloneWithColumns(chunk.detachColumns())); }
    void onFinish() override { RemoteInserter::onFinish(); }
};

}