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

Function explainStep

src/Processors/QueryPlan/QueryPlan.cpp:274–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274static void explainStep(const IQueryPlanStep & step, JSONBuilder::JSONMap & map, const ExplainPlanOptions & options)
275{
276 map.add("Node Type", step.getName());
277 map.add("Node Id", step.getUniqID());
278
279 if (options.description)
280 {
281 const auto & description = step.getStepDescription();
282 if (!description.empty())
283 map.add("Description", description);
284 }
285
286 const auto dump_column = [](JSONBuilder::JSONArray & header_array, const ColumnWithTypeAndName & column)
287 {
288 auto column_map = std::make_unique<JSONBuilder::JSONMap>();
289 column_map->add("Name", column.name);
290 if (column.type)
291 column_map->add("Type", column.type->getName());
292 header_array.add(std::move(column_map));
293 };
294
295 if (options.header && step.hasOutputHeader())
296 {
297 auto header_array = std::make_unique<JSONBuilder::JSONArray>();
298
299 for (const auto & output_column : *step.getOutputHeader())
300 dump_column(*header_array, output_column);
301
302 map.add("Header", std::move(header_array));
303 }
304
305 if (options.input_headers && !step.getInputHeaders().empty())
306 {
307 auto input_headers_array = std::make_unique<JSONBuilder::JSONArray>();
308
309 for (const auto & input_header : step.getInputHeaders())
310 {
311 auto header_array = std::make_unique<JSONBuilder::JSONArray>();
312
313 for (const auto & input_column : *input_header)
314 dump_column(*header_array, input_column);
315
316 input_headers_array->add(std::move(header_array));
317 }
318
319 map.add("Input Headers", std::move(input_headers_array));
320 }
321
322 if (options.actions)
323 step.describeActions(map);
324
325 if (options.indexes)
326 step.describeIndexes(map);
327
328 if (options.projections)
329 step.describeProjections(map);
330}
331

Callers 2

explainPlanMethod · 0.85
debugExplainStepFunction · 0.85

Calls 15

trimColumnIdentifierFunction · 0.85
dumpSortDescriptionFunction · 0.85
getStepDescriptionMethod · 0.80
hasOutputHeaderMethod · 0.80
getOutputHeaderMethod · 0.80
dumpNameAndTypeMethod · 0.80
getSortDescriptionMethod · 0.80
formatFunction · 0.50
addMethod · 0.45
getNameMethod · 0.45
getUniqIDMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected