aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/QueryPlan/ISourceStep.cpp
blob: 37f56bc7a43adf154813e8dc229cf2a4d906630c (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
33
34
35
36
#include <Processors/QueryPlan/ISourceStep.h>
#include <QueryPipeline/QueryPipelineBuilder.h>

namespace DB
{

ISourceStep::ISourceStep(DataStream output_stream_)
{
    output_stream = std::move(output_stream_);
}

QueryPipelineBuilderPtr ISourceStep::updatePipeline(QueryPipelineBuilders, const BuildQueryPipelineSettings & settings)
{
    auto pipeline = std::make_unique<QueryPipelineBuilder>();

    /// For `Source` step, since it's not add new Processors to `pipeline->pipe`
    /// in `initializePipeline`, but make an assign with new created Pipe.
    /// And Processors for the Step is added here. So we do not need to use
    /// `QueryPipelineProcessorsCollector` to collect Processors.
    initializePipeline(*pipeline, settings);

    /// But we need to set QueryPlanStep manually for the Processors, which
    /// will be used in `EXPLAIN PIPELINE`
    for (auto & processor : processors)
    {
        processor->setQueryPlanStep(this);
    }
    return pipeline;
}

void ISourceStep::describePipeline(FormatSettings & settings) const
{
    IQueryPlanStep::describePipeline(processors, settings);
}

}