Skip to content

Logical error: Sorting column wasn't found in the ActionsDAG's outputs #77558

@PedroTadim

Description

@PedroTadim

Describe the bug

This is a regression in the current master. It was introduced very recently, maybe yesterday.

How to reproduce

Run Fiddle: https://fiddle.clickhouse.com/2362815a-6c8f-4194-9b1e-9420a32b9935

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'Sorting column __table1.c1 wasn't found in the ActionsDAG's outputs. DAG:
0 : INPUT () (no column) Int32 c0
1 : COLUMN () Const(Int32) Int32 _CAST(1_Int32, 'Int32'_String)
Output nodes: 1
'.
<Fatal> : Stack trace (when copying this message, always include the lines below):

0. contrib/llvm-project/libcxx/include/__exception/exception.h:106: Poco::Exception::Exception(String const&, int) @ 0x000000001a6bb2b2
1. src/Common/Exception.cpp:108: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000f7a08b9
2. src/Common/Exception.h:112: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x0000000009e6a88c
3. src/Common/Exception.h:130: DB::Exception::Exception<String const&, String>(int, FormatStringHelperImpl<std::type_identity<String const&>::type, std::type_identity<String>::type>, String const&, String&&) @ 0x000000000a47138b
4. src/Interpreters/ActionsDAG.cpp:2215: DB::ActionsDAG::splitActionsBySortingDescription(std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>> const&) const @ 0x0000000013b31339
5. src/Processors/QueryPlan/Optimizations/liftUpFunctions.cpp:69: DB::QueryPlanOptimizations::tryExecuteFunctionsAfterSorting(DB::QueryPlan::Node*, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&, DB::QueryPlanOptimizations::Optimization::ExtraSettings const&) @ 0x0000000016a2477c
6. src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:95: DB::QueryPlanOptimizations::optimizeTreeFirstPass(DB::QueryPlanOptimizationSettings const&, DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x0000000016a01b20
7. src/Processors/QueryPlan/QueryPlan.cpp:489: DB::QueryPlan::optimize(DB::QueryPlanOptimizationSettings const&) @ 0x0000000016957631
8. src/Processors/QueryPlan/QueryPlan.cpp:175: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x0000000016956ec7
9. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:275: DB::InterpreterSelectQueryAnalyzer::buildQueryPipeline() @ 0x00000000144eabf4
10. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:242: DB::InterpreterSelectQueryAnalyzer::execute() @ 0x00000000144ea97e
11. src/Interpreters/executeQuery.cpp:1459: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&) @ 0x00000000147ff589
12. src/Interpreters/executeQuery.cpp:1626: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x00000000147fb02b
13. src/Server/TCPHandler.cpp:664: DB::TCPHandler::runImpl() @ 0x0000000016450161
14. src/Server/TCPHandler.cpp:2629: DB::TCPHandler::run() @ 0x00000000164682d9
15. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000001a75ac87
16. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000001a75b15e
17. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000001a7087d2
18. base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001a70640f
19. ? @ 0x00007ffff7ca1e2e
20. ? @ 0x00007ffff7d33a4c

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official releasefuzzProblem found by one of the fuzzers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions