MCPcopy Create free account
hub / github.com/ByConity/ByConity / Pipe

Method Pipe

src/Processors/Pipe.cpp:154–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154Pipe::Pipe(ProcessorPtr source, OutputPort * output, OutputPort * totals, OutputPort * extremes)
155{
156 if (!source->getInputs().empty())
157 throw Exception("Source for pipe shouldn't have any input, but " + source->getName() + " has " +
158 toString(source->getInputs().size()) + " inputs.", ErrorCodes::LOGICAL_ERROR);
159
160 if (!output)
161 throw Exception("Cannot create Pipe from source because specified output port is nullptr",
162 ErrorCodes::LOGICAL_ERROR);
163
164 if (output == totals || output == extremes || (totals && totals == extremes))
165 throw Exception("Cannot create Pipe from source because some of specified ports are the same",
166 ErrorCodes::LOGICAL_ERROR);
167
168 header = output->getHeader();
169
170 /// Check that ports belong to source and all ports from source were specified.
171 {
172 auto & outputs = source->getOutputs();
173 size_t num_specified_ports = 0;
174
175 auto check_port_from_source = [&](OutputPort * port, std::string name)
176 {
177 if (!port)
178 return;
179
180 assertBlocksHaveEqualStructure(header, port->getHeader(), name);
181
182 ++num_specified_ports;
183
184 auto it = std::find_if(outputs.begin(), outputs.end(), [port](const OutputPort & p) { return &p == port; });
185 if (it == outputs.end())
186 throw Exception("Cannot create Pipe because specified " + name + " port does not belong to source",
187 ErrorCodes::LOGICAL_ERROR);
188 };
189
190 check_port_from_source(output, "output");
191 check_port_from_source(totals, "totals");
192 check_port_from_source(extremes, "extremes");
193
194 if (num_specified_ports != outputs.size())
195 throw Exception("Cannot create Pipe from source because it has " + std::to_string(outputs.size()) +
196 " output ports, but " + std::to_string(num_specified_ports) + " were specified",
197 ErrorCodes::LOGICAL_ERROR);
198 }
199
200 totals_port = totals;
201 extremes_port = extremes;
202 output_ports.push_back(output);
203 processors.emplace_back(std::move(source));
204 max_parallel_streams = 1;
205}
206
207Pipe::Pipe(ProcessorPtr source)
208{

Callers

nothing calls this directly

Calls 15

frontMethod · 0.80
getOutputPortMethod · 0.80
checkSourceFunction · 0.70
ExceptionClass · 0.50
toStringFunction · 0.50
to_stringFunction · 0.50
emptyMethod · 0.45
getNameMethod · 0.45
sizeMethod · 0.45
getHeaderMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected