MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / prepare

Method prepare

src/Processors/Sources/DelayedSource.cpp:32–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32IProcessor::Status DelayedSource::prepare()
33{
34 /// At first, wait for main output is needed and expand pipeline.
35 if (inputs.empty())
36 {
37 auto & first_output = outputs.front();
38
39 /// If main output port was finished before callback was called, stop execution.
40 if (first_output.isFinished())
41 {
42 for (auto & output : outputs)
43 output.finish();
44
45 return Status::Finished;
46 }
47
48 if (!first_output.isNeeded())
49 return Status::PortFull;
50
51 /// Call creator callback to get processors.
52 if (processors.empty())
53 return Status::Ready;
54
55 return Status::UpdatePipeline;
56 }
57
58 /// Process ports in order: main, totals, extremes
59 auto output = outputs.begin();
60 for (auto input = inputs.begin(); input != inputs.end(); ++input, ++output)
61 {
62 if (output->isFinished())
63 {
64 input->close();
65 continue;
66 }
67
68 if (!output->canPush())
69 return Status::PortFull;
70
71 if (input->isFinished())
72 {
73 output->finish();
74 continue;
75 }
76
77 input->setNeeded();
78 if (!input->hasData())
79 return Status::NeedData;
80
81 output->pushData(input->pullData(true));
82 return Status::PortFull;
83 }
84
85 return Status::Finished;
86}
87
88/// Fix port from returned pipe. Create source_port if created or drop if source_port is null.
89static void synchronizePorts(OutputPort *& pipe_port, OutputPort * source_port, SharedHeader header, Processors & processors)

Callers

nothing calls this directly

Calls 13

canPushMethod · 0.80
setNeededMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45
isFinishedMethod · 0.45
finishMethod · 0.45
isNeededMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
closeMethod · 0.45
hasDataMethod · 0.45
pushDataMethod · 0.45

Tested by

no test coverage detected