aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Formats/formatBlock.cpp
blob: d2b401207aafb0ad39f643a99ee88b8a715e69c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <Core/Block.h>
#include <Formats/formatBlock.h>
#include <Processors/Formats/IOutputFormat.h>
#include <Processors/Sources/SourceFromSingleChunk.h>
#include <QueryPipeline/QueryPipeline.h>
#include <Processors/Executors/CompletedPipelineExecutor.h>

namespace DB
{

void formatBlock(OutputFormatPtr out, const Block & block)
{
    auto source = std::make_shared<SourceFromSingleChunk>(block);
    QueryPipeline pipeline(source);
    pipeline.complete(out);
    CompletedPipelineExecutor executor(pipeline);
    executor.execute();
    out->flush();
}

}