diff --git a/src/Interpreters/ActionsDAG.cpp b/src/Interpreters/ActionsDAG.cpp index 7240679abb7..324a59a9470 100644 --- a/src/Interpreters/ActionsDAG.cpp +++ b/src/Interpreters/ActionsDAG.cpp @@ -1713,6 +1713,10 @@ ActionsDAG::SplitResult ActionsDAG::split(std::unordered_set split } } + /// All input nodes are needed by split to make sure first DAG and initial DAG have equal inputs, + for (const auto * input: inputs) + data[input].needed_by_split_node = true; + /// DFS. Move nodes to one of the DAGs. for (const auto & node : nodes) {