diff --git a/src/Interpreters/ActionsDAG.cpp b/src/Interpreters/ActionsDAG.cpp index 1107f642b6a7..64eb298803c7 100644 --- a/src/Interpreters/ActionsDAG.cpp +++ b/src/Interpreters/ActionsDAG.cpp @@ -1762,6 +1762,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) {