-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Logical error: 'Bad cast from type DB::FunctionNode to DB::ConstantNode' with optimize_const_name_size #89607
Copy link
Copy link
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasefuzzProblem found by one of the fuzzersProblem found by one of the fuzzers
Description
Describe the bug
Seems related to #89195?
How to reproduce
Use:
<remote_servers>
<cluster0>
<shard>
<replica>
<host>localhost</host>
<port>9000</port>
</replica>
</shard>
</cluster0>
</remote_servers>Then run:
CREATE TABLE t0 (c0 Int) ENGINE = MergeTree() ORDER BY tuple();
CREATE TABLE t1 ENGINE = Distributed('cluster0', default, t0);
SELECT c0 FROM t1 OFFSET -1 ROWS SETTINGS optimize_const_name_size = 1;Error message and/or stacktrace
Stack trace:
<Fatal> : Logical error: 'Bad cast from type DB::FunctionNode to DB::ConstantNode'.
<Fatal> : Stack trace (when copying this message, always include the lines below):
0. contrib/llvm-project/libcxx/include/__exception/exception.h:113: Poco::Exception::Exception(String const&, int) @ 0x0000000024a5a1f2
1. src/Common/Exception.cpp:129: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000014fafbe9
2. src/Common/Exception.h:123: DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000d548f4e
3. src/Common/Exception.h:58: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000d548951
4. src/Common/Exception.h:141: DB::Exception::Exception<String, String>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String>::type>, String&&, String&&) @ 0x000000000d546cb6
5. src/Common/typeid_cast.h:31: T typeid_cast<DB::ConstantNode&, DB::IQueryTreeNode>(DB::IQueryTreeNode&) @ 0x000000001a176013
6. src/Common/TypePromotion.h:31: DB::(anonymous namespace)::buildQueryPlanForTableExpression(std::shared_ptr<DB::IQueryTreeNode>, std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions const&, std::shared_ptr<DB::PlannerContext>&, bool, bool) @ 0x000000001a4b2bce
7. src/Planner/PlannerJoinTree.cpp:2527: DB::buildJoinTreeQueryPlan(std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>> const&, std::shared_ptr<DB::PlannerContext>&) @ 0x000000001a4abd99
8. src/Planner/Planner.cpp:1759: DB::Planner::buildPlanForQueryNode() @ 0x000000001a48f674
9. src/Planner/Planner.cpp:1529: DB::Planner::buildQueryPlanIfNeeded() @ 0x000000001a48c2f0
10. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:250: DB::InterpreterSelectQueryAnalyzer::getSampleBlockAndPlannerContext(std::shared_ptr<DB::IQueryTreeNode> const&, std::shared_ptr<DB::Context const> const&, DB::SelectQueryOptions const&) @ 0x000000001ada799a
11. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:239: DB::InterpreterSelectQueryAnalyzer::getSampleBlock(std::shared_ptr<DB::IQueryTreeNode> const&, std::shared_ptr<DB::Context const> const&, DB::SelectQueryOptions const&) @ 0x000000001ada7b5a
12. src/Storages/StorageDistributed.cpp:1026: DB::StorageDistributed::read(DB::QueryPlan&, std::vector<String, std::allocator<String>> const&, std::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&, std::shared_ptr<DB::Context const>, DB::QueryProcessingStage::Enum, unsigned long, unsigned long) @ 0x000000001dc1afc1
13. src/Planner/PlannerJoinTree.cpp:1048: DB::(anonymous namespace)::buildQueryPlanForTableExpression(std::shared_ptr<DB::IQueryTreeNode>, std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions const&, std::shared_ptr<DB::PlannerContext>&, bool, bool) @ 0x000000001a4b7219
14. src/Planner/PlannerJoinTree.cpp:2527: DB::buildJoinTreeQueryPlan(std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>> const&, std::shared_ptr<DB::PlannerContext>&) @ 0x000000001a4abd99
15. src/Planner/Planner.cpp:1759: DB::Planner::buildPlanForQueryNode() @ 0x000000001a48f674
16. src/Planner/Planner.cpp:1529: DB::Planner::buildQueryPlanIfNeeded() @ 0x000000001a48c2f0
17. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:269: DB::InterpreterSelectQueryAnalyzer::getQueryPlan() @ 0x000000001ada8210
18. src/Interpreters/executeQuery.cpp:1549: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>, std::function<void ()>) @ 0x000000001b0c811f
19. src/Interpreters/executeQuery.cpp:1812: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x000000001b0c23f2
20. src/Server/TCPHandler.cpp:745: DB::TCPHandler::runImpl() @ 0x000000001ea62ed2
21. src/Server/TCPHandler.cpp:2843: DB::TCPHandler::run() @ 0x000000001ea7c7e4
22. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000024b10c07
23. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000024b111e5
24. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x0000000024ab037f
25. base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000024aada51
26. ? @ 0x00000000000a3d64
27. __GI___clone3 @ 0x00000000001373bc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasefuzzProblem found by one of the fuzzersProblem found by one of the fuzzers