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

Method addStep

src/QueryPlan/QueryPlan.cpp:147–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void QueryPlan::addStep(QueryPlanStepPtr step, PlanNodes children)
148{
149 (void)children;
150 checkNotCompleted();
151
152 size_t num_input_streams = step->getInputStreams().size();
153 if (num_input_streams == 0)
154 {
155 if (isInitialized())
156 throw Exception(
157 "Cannot add step " + step->getName()
158 + " to QueryPlan because "
159 "step has no inputs, but QueryPlan is already initialized",
160 ErrorCodes::LOGICAL_ERROR);
161
162 nodes.emplace_back(Node{.step = std::move(step)});
163 root = &nodes.back();
164 return;
165 }
166 else
167 {
168 if (!isInitialized())
169 throw Exception(
170 "Cannot add step " + step->getName()
171 + " to QueryPlan because "
172 "step has input, but QueryPlan is not initialized",
173 ErrorCodes::LOGICAL_ERROR);
174
175 const auto & root_header = root->step->getOutputStream().header;
176 const auto & step_header = step->getInputStreams().front().header;
177 if (!blocksHaveEqualStructure(root_header, step_header))
178 throw Exception(
179 "Cannot add step " + step->getName()
180 + " to QueryPlan because "
181 "it has incompatible header with root step "
182 + root->step->getName()
183 + " "
184 "root header: "
185 + root_header.dumpStructure() + "step header: " + step_header.dumpStructure(),
186 ErrorCodes::LOGICAL_ERROR);
187
188 nodes.emplace_back(Node{.step = std::move(step), .children = {root}});
189 root = &nodes.back();
190 return;
191 }
192}
193
194void QueryPlan::addNode(Node && node_)
195{

Callers 15

readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readFromPartsMethod · 0.45
readMethod · 0.45
readMethod · 0.45
buildMethod · 0.45

Calls 8

blocksHaveEqualStructureFunction · 0.85
frontMethod · 0.80
ExceptionClass · 0.50
sizeMethod · 0.45
getNameMethod · 0.45
emplace_backMethod · 0.45
getOutputStreamMethod · 0.45
dumpStructureMethod · 0.45

Tested by

no test coverage detected