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

Function addExpressionStep

src/Planner/Planner.cpp:565–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563
564template <size_t size>
565ALWAYS_INLINE void addExpressionStep(
566 const PlannerContextPtr & planner_context,
567 QueryPlan & query_plan,
568 ActionsAndProjectInputsFlagPtr & expression_actions,
569 const CorrelatedSubtrees & correlated_subtrees,
570 const SelectQueryOptions & select_query_options,
571 const char (&step_description)[size],
572 UsefulSets & useful_sets)
573{
574 NameSet input_columns_set;
575 for (const auto & column : query_plan.getCurrentHeader()->getColumnsWithTypeAndName())
576 input_columns_set.insert(column.name);
577 for (const auto & correlated_subquery : correlated_subtrees.subqueries)
578 {
579 for (const auto & identifier : correlated_subquery.correlated_column_identifiers)
580 {
581 if (!input_columns_set.contains(identifier))
582 throw Exception(
583 ErrorCodes::NOT_IMPLEMENTED,
584 "Current query is not supported yet, because can't find correlated column '{}' in current header: {}",
585 identifier,
586 query_plan.getCurrentHeader()->dumpNames());
587 }
588 buildQueryPlanForCorrelatedSubquery(planner_context, query_plan, correlated_subquery, select_query_options);
589 }
590
591 auto actions = std::move(expression_actions->dag);
592 if (expression_actions->project_input)
593 actions.appendInputsForUnusedColumns(*query_plan.getCurrentHeader());
594
595 auto expression_step = std::make_unique<ExpressionStep>(query_plan.getCurrentHeader(), std::move(actions));
596 appendSetsFromActionsDAG(expression_step->getExpression(), useful_sets);
597 expression_step->setStepDescription(step_description);
598 query_plan.addStep(std::move(expression_step));
599}
600
601template <size_t size>
602ALWAYS_INLINE void addFilterStep(

Calls 10

appendSetsFromActionsDAGFunction · 0.85
ExceptionClass · 0.50
insertMethod · 0.45
containsMethod · 0.45
dumpNamesMethod · 0.45
getExpressionMethod · 0.45
setStepDescriptionMethod · 0.45
addStepMethod · 0.45

Tested by

no test coverage detected