From 698a984c074390127b6989705f9b31ae5a89df7a Mon Sep 17 00:00:00 2001 From: Nickita Taranov Date: Thu, 31 Mar 2022 13:39:05 +0200 Subject: [PATCH] throw if sorting column not found --- src/Interpreters/ActionsDAG.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Interpreters/ActionsDAG.cpp b/src/Interpreters/ActionsDAG.cpp index ea90bedd2f6..f06ac229e94 100644 --- a/src/Interpreters/ActionsDAG.cpp +++ b/src/Interpreters/ActionsDAG.cpp @@ -1533,6 +1533,10 @@ ActionsDAG::SplitResult ActionsDAG::splitActionsBySortingDescription(const NameS for (const auto & sort_column : sort_columns) if (const auto * node = tryFindInIndex(sort_column)) split_nodes.insert(node); + else + throw Exception( + ErrorCodes::LOGICAL_ERROR, "Sorting column {} wasn't found in the ActionsDAG's index. DAG:\n{}", sort_column, dumpDAG()); + auto res = split(split_nodes); res.second->project_input = project_input; return res;