| 40 | } |
| 41 | |
| 42 | QueryPipelinePtr IntersectOrExceptStep::updatePipeline(QueryPipelines pipelines, const BuildQueryPipelineSettings &) |
| 43 | { |
| 44 | auto pipeline = std::make_unique<QueryPipeline>(); |
| 45 | QueryPipelineProcessorsCollector collector(*pipeline, this); |
| 46 | |
| 47 | if (pipelines.empty()) |
| 48 | { |
| 49 | pipeline->init(Pipe(std::make_shared<NullSource>(output_stream->header))); |
| 50 | processors = collector.detachProcessors(); |
| 51 | return pipeline; |
| 52 | } |
| 53 | |
| 54 | for (auto & cur_pipeline : pipelines) |
| 55 | { |
| 56 | /// Just in case. |
| 57 | if (!isCompatibleHeader(cur_pipeline->getHeader(), getOutputStream().header)) |
| 58 | { |
| 59 | auto converting_dag = ActionsDAG::makeConvertingActions( |
| 60 | cur_pipeline->getHeader().getColumnsWithTypeAndName(), |
| 61 | getOutputStream().header.getColumnsWithTypeAndName(), |
| 62 | ActionsDAG::MatchColumnsMode::Name); |
| 63 | |
| 64 | auto converting_actions = std::make_shared<ExpressionActions>(std::move(converting_dag)); |
| 65 | cur_pipeline->addSimpleTransform([&](const Block & cur_header) |
| 66 | { |
| 67 | return std::make_shared<ExpressionTransform>(cur_header, converting_actions); |
| 68 | }); |
| 69 | } |
| 70 | |
| 71 | /// For the case of union. |
| 72 | cur_pipeline->addTransform(std::make_shared<ResizeProcessor>(header, cur_pipeline->getNumStreams(), 1)); |
| 73 | } |
| 74 | |
| 75 | *pipeline = QueryPipeline::unitePipelines(std::move(pipelines), max_threads); |
| 76 | pipeline->addTransform(std::make_shared<IntersectOrExceptTransform>(header, current_operator)); |
| 77 | |
| 78 | processors = collector.detachProcessors(); |
| 79 | return pipeline; |
| 80 | } |
| 81 | |
| 82 | void IntersectOrExceptStep::describePipeline(FormatSettings & settings) const |
| 83 | { |
nothing calls this directly
no test coverage detected