Skip to content

Logical error: 'Bad cast from type DB::IdentifierNode to DB::ColumnNode' #80875

@kssenii

Description

@kssenii

Describe the bug

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=80745&sha=82b6004fe1e09f3c35decd66052c3f56ece1edd7&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan%29

How to reproduce

query_id: 13066f2e-c9c3-4a8f-8812-812d3c443130) (query: SELECT * FROM numbers(1) AS t1 ANY LEFT JOIN numbers(1, 46 AND (toLowCardinality(46) AND (* AND assumeNotNull(46) AND isNullable(46))) AND (isNullable(46) AND (1 IS NULL))) AS t2 USING (number) GROUP BY 1, ((isZeroOrNull(1) AND toLowCardinality(toNullable(46)) AND 46) AND 46 AND (46 AND (assumeNotNull(1) AND isZeroOrNull(materialize(46))))) AND assumeNotNull(1), assumeNotNull(isNullable(46) AND 46 AND (toUInt128(1) IS NULL), 1)

Error message and/or stacktrace

2025.05.26 16:41:38.407342 [ 178 ] {13066f2e-c9c3-4a8f-8812-812d3c443130} <Fatal> : Logical error: 'Bad cast from type DB::IdentifierNode to DB::ColumnNode'.
2025.05.26 16:41:38.482478 [ 178 ] {13066f2e-c9c3-4a8f-8812-812d3c443130} <Fatal> : Stack trace (when copying this message, always include the lines below):
2025.05.26 16:41:38.483267 [ 1533 ] {} <Fatal> BaseDaemon: ########## Short fault info ############
2025.05.26 16:41:38.483347 [ 1533 ] {} <Fatal> BaseDaemon: (version 25.6.1.1, build id: 06F00F07F8E32B6C350C0774E26C69EFC17D5D06, git hash: f17214b470b3a399c401e9eee3d986ded5d23140, architecture: aarch64) (from thread 178) Received signal 6
2025.05.26 16:41:38.483393 [ 1533 ] {} <Fatal> BaseDaemon: Signal description: Aborted
2025.05.26 16:41:38.483427 [ 1533 ] {} <Fatal> BaseDaemon: 
2025.05.26 16:41:38.483488 [ 1533 ] {} <Fatal> BaseDaemon: Stack trace: 0x0000ff3e66f5f1f1 0x0000ff3e66f1a67c 0x0000ff3e66f07130 0x0000aaae1ec09430 0x0000aaae1ec0a5b4 0x0000aaae126c7fcc 0x0000aaae126c77e0 0x0000aaae291472b4 0x0000aaae2915c5ac 0x0000aaae2915e10c 0x0000aaae2912970c 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912cdec 0x0000aaae2916f4c8 0x0000aaae29172220 0x0000aaae2916f4ac 0x0000aaae2911e73c 0x0000aaae2911cca4 0x0000aaae2911b9f0 0x0000aaae291c8350 0x0000aaae2a724148 0x0000aaae2a7208cc 0x0000aaae2a726e98 0x0000aaae2a652d08 0x0000aaae2ac995f8 0x0000aaae2ac92f9c 0x0000aaae2ed96a60 0x0000aaae2edcc1e8 0x0000aaae35bc1518 0x0000aaae35bc2068 0x0000aaae35ae5298 0x0000aaae35adfd58 0x0000aaae12681840 0x0000ff3e66f5d5b8
2025.05.26 16:41:38.483538 [ 1533 ] {} <Fatal> BaseDaemon: ########################################
2025.05.26 16:41:38.483674 [ 1533 ] {} <Fatal> BaseDaemon: (version 25.6.1.1, build id: 06F00F07F8E32B6C350C0774E26C69EFC17D5D06, git hash: f17214b470b3a399c401e9eee3d986ded5d23140) (from thread 178) (query_id: 13066f2e-c9c3-4a8f-8812-812d3c443130) (query: SELECT * FROM numbers(1) AS t1 ANY LEFT JOIN numbers(1, 46 AND (toLowCardinality(46) AND (* AND assumeNotNull(46) AND isNullable(46))) AND (isNullable(46) AND (1 IS NULL))) AS t2 USING (number) GROUP BY 1, ((isZeroOrNull(1) AND toLowCardinality(toNullable(46)) AND 46) AND 46 AND (46 AND (assumeNotNull(1) AND isZeroOrNull(materialize(46))))) AND assumeNotNull(1), assumeNotNull(isNullable(46) AND 46 AND (toUInt128(1) IS NULL), 1)) Received signal Aborted (6)
2025.05.26 16:41:38.483815 [ 1533 ] {} <Fatal> BaseDaemon: 
2025.05.26 16:41:38.483925 [ 1533 ] {} <Fatal> BaseDaemon: Stack trace: 0x0000ff3e66f5f1f1 0x0000ff3e66f1a67c 0x0000ff3e66f07130 0x0000aaae1ec09430 0x0000aaae1ec0a5b4 0x0000aaae126c7fcc 0x0000aaae126c77e0 0x0000aaae291472b4 0x0000aaae2915c5ac 0x0000aaae2915e10c 0x0000aaae2912970c 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912810c 0x0000aaae2914c2b4 0x0000aaae291294a4 0x0000aaae2912cdec 0x0000aaae2916f4c8 0x0000aaae29172220 0x0000aaae2916f4ac 0x0000aaae2911e73c 0x0000aaae2911cca4 0x0000aaae2911b9f0 0x0000aaae291c8350 0x0000aaae2a724148 0x0000aaae2a7208cc 0x0000aaae2a726e98 0x0000aaae2a652d08 0x0000aaae2ac995f8 0x0000aaae2ac92f9c 0x0000aaae2ed96a60 0x0000aaae2edcc1e8 0x0000aaae35bc1518 0x0000aaae35bc2068 0x0000aaae35ae5298 0x0000aaae35adfd58 0x0000aaae12681840 0x0000ff3e66f5d5b8
2025.05.26 16:41:38.484135 [ 1533 ] {} <Fatal> BaseDaemon: 3. __pthread_kill_implementation @ 0x000000000007f1f1
2025.05.26 16:41:38.484265 [ 1533 ] {} <Fatal> BaseDaemon: 4. gsignal @ 0x000000000003a67c
2025.05.26 16:41:38.484386 [ 1533 ] {} <Fatal> BaseDaemon: 5. abort @ 0x0000000000027130
2025.05.26 16:41:38.550017 [ 1533 ] {} <Fatal> BaseDaemon: 6. ./ci/tmp/build/./src/Common/Exception.cpp:50: DB::abortOnFailedAssertion(String const&, void* const*, unsigned long, unsigned long) @ 0x00000000191c9430
2025.05.26 16:41:38.612777 [ 1533 ] {} <Fatal> BaseDaemon: 7.0. inlined from ./ci/tmp/build/./src/Common/Exception.cpp:72: DB::handle_error_code(String const&, int, bool, std::vector<void*, std::allocator<void*>> const&)
2025.05.26 16:41:38.612924 [ 1533 ] {} <Fatal> BaseDaemon: 7. ./ci/tmp/build/./src/Common/Exception.cpp:116: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x00000000191ca5b4
2025.05.26 16:41:38.703788 [ 1533 ] {} <Fatal> BaseDaemon: 8. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000cc87fcc
2025.05.26 16:41:38.748802 [ 1533 ] {} <Fatal> BaseDaemon: 9. DB::Exception::Exception<String, String>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String>::type>, String&&, String&&) @ 0x000000000cc877e0
2025.05.26 16:41:39.278971 [ 1533 ] {} <Fatal> BaseDaemon: 10.0. inlined from ./src/Common/typeid_cast.h:31: T typeid_cast<DB::ColumnNode&, DB::IQueryTreeNode>(DB::IQueryTreeNode&)
2025.05.26 16:41:39.279088 [ 1533 ] {} <Fatal> BaseDaemon: 10.1. inlined from ./src/Common/TypePromotion.h:31: DB::TypePromotion<DB::IQueryTreeNode>::CastHelper<DB::ColumnNode&, false, true>::value(DB::IQueryTreeNode*)
2025.05.26 16:41:39.279160 [ 1533 ] {} <Fatal> BaseDaemon: 10.2. inlined from ./src/Common/TypePromotion.h:57: std::invoke_result<decltype(&CastHelper<DB::ColumnNode&, false>::value), DB::TypePromotion<DB::IQueryTreeNode>::CastHelper<DB::ColumnNode&, false, std::is_reference_v<DB::ColumnNode&>>, DB::IQueryTreeNode*>::type DB::TypePromotion<DB::IQueryTreeNode>::as<DB::ColumnNode&>()
2025.05.26 16:41:39.279235 [ 1533 ] {} <Fatal> BaseDaemon: 10. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:1805: DB::QueryAnalyzer::updateMatchedColumnsFromJoinUsing(std::vector<std::pair<std::shared_ptr<DB::IQueryTreeNode>, String>, std::allocator<std::pair<std::shared_ptr<DB::IQueryTreeNode>, String>>>&, std::shared_ptr<DB::IQueryTreeNode> const&, DB::IdentifierResolveScope&) @ 0x00000000237072b4
2025.05.26 16:41:39.843152 [ 1533 ] {} <Fatal> BaseDaemon: 11. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:2213: DB::QueryAnalyzer::resolveUnqualifiedMatcher(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&) @ 0x000000002371c5ac
2025.05.26 16:41:40.309210 [ 1533 ] {} <Fatal> BaseDaemon: 12. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:2243: DB::QueryAnalyzer::resolveMatcher(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&) @ 0x000000002371e10c
2025.05.26 16:41:40.723764 [ 1533 ] {} <Fatal> BaseDaemon: 13. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:3872: DB::QueryAnalyzer::resolveExpressionNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool, bool) @ 0x00000000236e970c
2025.05.26 16:41:41.101809 [ 1533 ] {} <Fatal> BaseDaemon: 14. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:4063: DB::QueryAnalyzer::resolveExpressionNodeList(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool) @ 0x00000000236e810c
2025.05.26 16:41:41.428080 [ 1533 ] {} <Fatal> BaseDaemon: 15. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:2942: DB::QueryAnalyzer::resolveFunction(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&) @ 0x000000002370c2b4
2025.05.26 16:41:41.814772 [ 1533 ] {} <Fatal> BaseDaemon: 16. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:3912: DB::QueryAnalyzer::resolveExpressionNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool, bool) @ 0x00000000236e94a4
2025.05.26 16:41:42.192702 [ 1533 ] {} <Fatal> BaseDaemon: 17. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:4063: DB::QueryAnalyzer::resolveExpressionNodeList(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool) @ 0x00000000236e810c
2025.05.26 16:41:42.525861 [ 1533 ] {} <Fatal> BaseDaemon: 18. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:2942: DB::QueryAnalyzer::resolveFunction(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&) @ 0x000000002370c2b4
2025.05.26 16:41:42.914279 [ 1533 ] {} <Fatal> BaseDaemon: 19. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:3912: DB::QueryAnalyzer::resolveExpressionNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool, bool) @ 0x00000000236e94a4
2025.05.26 16:41:43.295092 [ 1533 ] {} <Fatal> BaseDaemon: 20. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:4063: DB::QueryAnalyzer::resolveExpressionNodeList(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool) @ 0x00000000236e810c
2025.05.26 16:41:43.650454 [ 1533 ] {} <Fatal> BaseDaemon: 21. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:2942: DB::QueryAnalyzer::resolveFunction(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&) @ 0x000000002370c2b4
2025.05.26 16:41:44.054312 [ 1533 ] {} <Fatal> BaseDaemon: 22. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:3912: DB::QueryAnalyzer::resolveExpressionNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, bool, bool, bool) @ 0x00000000236e94a4
2025.05.26 16:41:44.451385 [ 1533 ] {} <Fatal> BaseDaemon: 23. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:4885: DB::QueryAnalyzer::resolveTableFunction(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, DB::QueryExpressionsAliasVisitor&, bool) @ 0x00000000236ecdec
2025.05.26 16:41:44.871523 [ 1533 ] {} <Fatal> BaseDaemon: 24. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:5480: DB::QueryAnalyzer::resolveQueryJoinTreeNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, DB::QueryExpressionsAliasVisitor&) @ 0x000000002372f4c8
2025.05.26 16:41:45.444651 [ 1533 ] {} <Fatal> BaseDaemon: 25. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:5274: DB::QueryAnalyzer::resolveJoin(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, DB::QueryExpressionsAliasVisitor&) @ 0x0000000023732220
2025.05.26 16:41:45.842149 [ 1533 ] {} <Fatal> BaseDaemon: 26. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:5499: DB::QueryAnalyzer::resolveQueryJoinTreeNode(std::shared_ptr<DB::IQueryTreeNode>&, DB::IdentifierResolveScope&, DB::QueryExpressionsAliasVisitor&) @ 0x000000002372f4ac
2025.05.26 16:41:46.269233 [ 1533 ] {} <Fatal> BaseDaemon: 27. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:5738: DB::QueryAnalyzer::resolveQuery(std::shared_ptr<DB::IQueryTreeNode> const&, DB::IdentifierResolveScope&) @ 0x00000000236de73c
2025.05.26 16:41:46.648304 [ 1533 ] {} <Fatal> BaseDaemon: 28. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalyzer.cpp:179: DB::QueryAnalyzer::resolve(std::shared_ptr<DB::IQueryTreeNode>&, std::shared_ptr<DB::IQueryTreeNode> const&, std::shared_ptr<DB::Context const>) @ 0x00000000236dcca4
2025.05.26 16:41:46.655723 [ 1533 ] {} <Fatal> BaseDaemon: 29. ./ci/tmp/build/./src/Analyzer/Resolve/QueryAnalysisPass.cpp:18: DB::QueryAnalysisPass::run(std::shared_ptr<DB::IQueryTreeNode>&, std::shared_ptr<DB::Context const>) @ 0x00000000236db9f0
2025.05.26 16:41:46.695459 [ 1533 ] {} <Fatal> BaseDaemon: 30. ./ci/tmp/build/./src/Analyzer/QueryTreePassManager.cpp:187: DB::QueryTreePassManager::run(std::shared_ptr<DB::IQueryTreeNode>) @ 0x0000000023788350
2025.05.26 16:41:46.814546 [ 1533 ] {} <Fatal> BaseDaemon: 31. ./ci/tmp/build/./src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:165: DB::buildQueryTreeAndRunPasses(std::shared_ptr<DB::IAST> const&, DB::SelectQueryOptions const&, std::shared_ptr<DB::Context const> const&, std::shared_ptr<DB::IStorage> const&) @ 0x0000000024ce4148
2025.05.26 16:41:46.908942 [ 1533 ] {} <Fatal> BaseDaemon: 32. ./ci/tmp/build/./src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:182: DB::InterpreterSelectQueryAnalyzer::InterpreterSelectQueryAnalyzer(std::shared_ptr<DB::IAST> const&, std::shared_ptr<DB::Context const> const&, DB::SelectQueryOptions const&, std::vector<String, std::allocator<String>> const&) @ 0x0000000024ce08cc
2025.05.26 16:41:47.029462 [ 1533 ] {} <Fatal> BaseDaemon: 33. ./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:634: std::__unique_if<DB::InterpreterSelectQueryAnalyzer>::__unique_single std::make_unique[abi:ne190107]<DB::InterpreterSelectQueryAnalyzer, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&>(std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&) @ 0x0000000024ce6e98
2025.05.26 16:41:47.064165 [ 1533 ] {} <Fatal> BaseDaemon: 34.0. inlined from ./contrib/llvm-project/libcxx/include/__functional/function.h:716: ?
2025.05.26 16:41:47.064270 [ 1533 ] {} <Fatal> BaseDaemon: 34.1. inlined from ./contrib/llvm-project/libcxx/include/__functional/function.h:989: ?
2025.05.26 16:41:47.064337 [ 1533 ] {} <Fatal> BaseDaemon: 34. ./ci/tmp/build/./src/Interpreters/InterpreterFactory.cpp:393: DB::InterpreterFactory::get(std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::Context>, DB::SelectQueryOptions const&) @ 0x0000000024c12d08
2025.05.26 16:41:47.251752 [ 1533 ] {} <Fatal> BaseDaemon: 35. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1454: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&) @ 0x00000000252595f8
2025.05.26 16:41:47.500453 [ 1533 ] {} <Fatal> BaseDaemon: 36. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1714: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x0000000025252f9c
2025.05.26 16:41:47.668467 [ 1533 ] {} <Fatal> BaseDaemon: 37. ./ci/tmp/build/./src/Server/TCPHandler.cpp:686: DB::TCPHandler::runImpl() @ 0x0000000029356a60
2025.05.26 16:41:47.958852 [ 1533 ] {} <Fatal> BaseDaemon: 38. ./ci/tmp/build/./src/Server/TCPHandler.cpp:2674: DB::TCPHandler::run() @ 0x000000002938c1e8
2025.05.26 16:41:47.965441 [ 1533 ] {} <Fatal> BaseDaemon: 39. ./ci/tmp/build/./base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000030181518
2025.05.26 16:41:47.977647 [ 1533 ] {} <Fatal> BaseDaemon: 40. ./ci/tmp/build/./base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000030182068
2025.05.26 16:41:47.991268 [ 1533 ] {} <Fatal> BaseDaemon: 41. ./ci/tmp/build/./base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x00000000300a5298
2025.05.26 16:41:48.004592 [ 1533 ] {} <Fatal> BaseDaemon: 42. ./base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000003009fd58
2025.05.26 16:41:48.049435 [ 1533 ] {} <Fatal> BaseDaemon: 43. asan_thread_start(void*) @ 0x000000000cc41840
2025.05.26 16:41:48.049569 [ 1533 ] {} <Fatal> BaseDaemon: 44. start_thread @ 0x000000000007d5b8
2025.05.26 16:41:48.049620 [ 1533 ] {} <Fatal> BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read.
2025.05.26 16:42:06.947107 [ 1533 ] {} <Fatal> BaseDaemon: This ClickHouse version is not official and should be upgraded to the official build.
2025.05.26 16:42:06.947436 [ 1533 ] {} <Fatal> BaseDaemon: Changed settings: receive_timeout = 10., receive_data_timeout_ms = 10000, allow_suspicious_low_cardinality_types = true, log_queries = true, table_function_remote_max_addresses = 200, max_execution_time = 10., max_memory_usage = 10000000000, send_logs_level = 'fatal', allow_introspection_functions = true, parallel_replicas_for_cluster_engines = false
2025.05.26 16:42:34.641927 [ 168 ] {} <Fatal> Application: Child process was terminated by signal 6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fuzzProblem 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