aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Transforms/StreamInQueryCacheTransform.cpp
blob: 6bcae1d30535be3d7f2b9df4b10fc89251fb2c3d (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
#include <Processors/Transforms/StreamInQueryCacheTransform.h>

namespace DB
{

StreamInQueryCacheTransform::StreamInQueryCacheTransform(
    const Block & header_,
    std::shared_ptr<QueryCache::Writer> query_cache_writer_,
    QueryCache::Writer::ChunkType chunk_type_)
    : ISimpleTransform(header_, header_, false)
    , query_cache_writer(query_cache_writer_)
    , chunk_type(chunk_type_)
{
}

void StreamInQueryCacheTransform::transform(Chunk & chunk)
{
    query_cache_writer->buffer(chunk.clone(), chunk_type);
}

void StreamInQueryCacheTransform::finalizeWriteInQueryCache()
{
    if (!isCancelled())
        query_cache_writer->finalizeWrite();
}

};