https://s3.amazonaws.com/clickhouse-test-reports/42933/e68a3b0c7addd3bd2fb49d163c1599e91f322a7f/fuzzer_astfuzzerubsan//server.log

```
../src/Parsers/ASTSelectQuery.cpp:122:22: runtime error: member call on null pointer of type 'DB::IAST'
2022.11.04 01:33:55.000163 [ 363 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 3.28 GiB, peak 10.92 GiB, free memory in arenas 0.00 B, will set to 3.29 GiB (RSS), difference: 12.73 MiB
    #0 0x2df1323e in DB::ASTSelectQuery::formatImpl(DB::IAST::FormatSettings const&, DB::IAST::FormatState&, DB::IAST::FormatStateStacked) const build_docker/../src/Parsers/ASTSelectQuery.cpp:122:22
    #1 0x2a5597a0 in DB::IAST::format(DB::IAST::FormatSettings const&) const build_docker/../src/Parsers/IAST.h:234:9
    #2 0x2e0379d5 in DB::formatAST(DB::IAST const&, DB::WriteBuffer&, bool, bool) build_docker/../src/Parsers/formatAST.cpp:12:9
    #3 0x2e037a3b in DB::serializeAST(DB::IAST const&, bool) build_docker/../src/Parsers/formatAST.cpp:18:5
    #4 0x2e045529 in DB::queryToString(DB::IAST const&) build_docker/../src/Parsers/queryToString.cpp:13:16
    #5 0x2e045529 in DB::queryToString(std::__1::shared_ptr<DB::IAST> const&) build_docker/../src/Parsers/queryToString.cpp:8:16
    #6 0x2c1e9d5e in DB::TreeRewriterResult::collectUsedColumns(std::__1::shared_ptr<DB::IAST> const&, bool, bool) build_docker/../src/Interpreters/TreeRewriter.cpp:1140:47
    #7 0x2c1ef575 in DB::TreeRewriter::analyzeSelect(std::__1::shared_ptr<DB::IAST>&, DB::TreeRewriterResult&&, DB::SelectQueryOptions const&, std::__1::vector<DB::TableWithColumnNamesAndTypes, std::__1::allocator<DB::TableWithColumnNamesAndTypes>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::TableJoin>) const build_docker/../src/Interpreters/TreeRewriter.cpp:1313:12
    #8 0x2ca60cd0 in DB::ReadFromMerge::initializePipeline(DB::QueryPipelineBuilder&, DB::BuildQueryPipelineSettings const&) build_docker/../src/Storages/StorageMerge.cpp:411:52
    #9 0x2db80e7c in DB::ISourceStep::updatePipeline(std::__1::vector<std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>, std::__1::allocator<std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>>>, DB::BuildQueryPipelineSettings const&) build_docker/../src/Processors/QueryPlan/ISourceStep.cpp:16:5
    #10 0x2dbaadbb in DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) build_docker/../src/Processors/QueryPlan/QueryPlan.cpp:187:47
    #11 0x2be97884 in DB::InterpreterSelectWithUnionQuery::execute() build_docker/../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:370:31
    #12 0x2c2f3f19 in DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) build_docker/../src/Interpreters/executeQuery.cpp:709:36
    #13 0x2c2ef8eb in DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) build_docker/../src/Interpreters/executeQuery.cpp:1106:30
    #14 0x2d49f32f in DB::TCPHandler::runImpl() build_docker/../src/Server/TCPHandler.cpp:374:24
    #15 0x2d4bfe39 in DB::TCPHandler::run() build_docker/../src/Server/TCPHandler.cpp:1902:9
    #16 0x2e48bb6b in Poco::Net::TCPServerConnection::start() build_docker/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3
    #17 0x2e48c059 in Poco::Net::TCPServerDispatcher::run() build_docker/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20
    #18 0x2e603a26 in Poco::PooledThread::run() build_docker/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14
    #19 0x2e60150e in Poco::ThreadImpl::runnableEntry(void*) build_docker/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27
    #20 0x7f686df67608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
    #21 0x7f686de8c132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/Parsers/ASTSelectQuery.cpp:122:22 in 
2022.11.04 01:33:56.280916 [ 135 ] {} <Trace> BaseDaemon: Received signal -3
2022.11.04 01:33:56.282516 [ 3085 ] {} <Fatal> BaseDaemon: ########################################
2022.11.04 01:33:56.282625 [ 3085 ] {} <Fatal> BaseDaemon: (version 22.11.1.1, build id: AD8FFE8A760B8FEF7DB4DC7624C9C353C218EC6F) (from thread 149) (query_id: c8ca5fc0-e63a-4524-ba36-342c70b1bfd4) (query: SELECT * FROM m INNER JOIN b__fuzz_0 USING (key) GROUP BY GROUPING SETS ((ID), (key))) Received signal Unknown signal (-3)
2022.11.04 01:33:56.282657 [ 3085 ] {} <Fatal> BaseDaemon: Sanitizer trap.
2022.11.04 01:33:56.282707 [ 3085 ] {} <Fatal> BaseDaemon: Stack trace: 0x204c4e03 0x20767c76 0x1632aaf6 0x1633acb3 0x2df1323f 0x2a5597a1 0x2e0379d6 0x2e037a3c 0x2e04552a 0x2c1e9d5f 0x2c1ef576 0x2ca60cd1 0x2db80e7d 0x2dbaadbc 0x2be97885 0x2c2f3f1a 0x2c2ef8ec 0x2d49f330 0x2d4bfe3a 0x2e48bb6c 0x2e48c05a 0x2e603a27 0x2e60150f 0x7f686df67609 0x7f686de8c133
2022.11.04 01:33:56.296340 [ 3085 ] {} <Fatal> BaseDaemon: 0.1. inlined from ./build_docker/../src/Common/StackTrace.cpp:332: StackTrace::tryCapture()
2022.11.04 01:33:56.296405 [ 3085 ] {} <Fatal> BaseDaemon: 0. ./build_docker/../src/Common/StackTrace.cpp:293: StackTrace::StackTrace() @ 0x204c4e03 in /workspace/clickhouse
2022.11.04 01:33:56.320796 [ 3085 ] {} <Fatal> BaseDaemon: 1. ./build_docker/../src/Daemon/BaseDaemon.cpp:0: sanitizerDeathCallback() @ 0x20767c76 in /workspace/clickhouse
2022.11.04 01:33:56.772420 [ 350 ] {} <Trace> SystemLog (system.asynchronous_metric_log): Flushing system log, 1610 entries to flush up to offset 146654
2022.11.04 01:33:56.776701 [ 350 ] {} <Trace> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.04 01:33:56.776750 [ 350 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 83.24 GiB.
2022.11.04 01:33:56.788823 [ 350 ] {} <Trace> MergedBlockOutputStream: filled checksums 202211_91_91_0 (state Temporary)
2022.11.04 01:33:56.789120 [ 350 ] {} <Trace> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638): Renaming temporary part tmp_insert_202211_91_91_0 to 202211_91_91_0.
2022.11.04 01:33:56.789327 [ 251 ] {} <Debug> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638) (MergerMutator): Selected 6 parts from 202211_1_86_17 to 202211_91_91_0
2022.11.04 01:33:56.789401 [ 350 ] {} <Trace> SystemLog (system.asynchronous_metric_log): Flushed system log up to offset 146654
2022.11.04 01:33:56.789500 [ 251 ] {} <Trace> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.04 01:33:56.789535 [ 251 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 83.24 GiB.
2022.11.04 01:33:56.789740 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTask::PrepareStage: Merging 6 parts: from 202211_1_86_17 to 202211_91_91_0 into Compact
2022.11.04 01:33:56.790113 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTask::PrepareStage: Selected MergeAlgorithm: Horizontal
2022.11.04 01:33:56.790171 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 18 marks from part 202211_1_86_17, total 138600 rows starting from the beginning of the part
2022.11.04 01:33:56.790419 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_87_87_0, total 1612 rows starting from the beginning of the part
2022.11.04 01:33:56.790626 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_88_88_0, total 1610 rows starting from the beginning of the part
2022.11.04 01:33:56.790829 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_89_89_0, total 1612 rows starting from the beginning of the part
2022.11.04 01:33:56.791003 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_90_90_0, total 1610 rows starting from the beginning of the part
2022.11.04 01:33:56.791184 [ 187 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_91_91_0, total 1610 rows starting from the beginning of the part
2022.11.04 01:33:56.896083 [ 186 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Debug> MergeTask::MergeProjectionsStage: Merge sorted 146654 rows, containing 4 columns (4 merged, 0 gathered) in 0.106425537 sec., 1377996.335597536 rows/sec., 20.06 MiB/sec.
2022.11.04 01:33:56.897416 [ 177 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Trace> MergedBlockOutputStream: filled checksums 202211_1_91_18 (state Temporary)
2022.11.04 01:33:56.897788 [ 177 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Trace> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638): Renaming temporary part tmp_merge_202211_1_91_18 to 202211_1_91_18.
2022.11.04 01:33:56.897870 [ 177 ] {9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18} <Trace> system.asynchronous_metric_log (9c0d5b40-996d-41ff-8c86-fa215963e638) (MergerMutator): Merged 6 parts: from 202211_1_86_17 to 202211_91_91_0
2022.11.04 01:33:56.898029 [ 177 ] {} <Debug> MemoryTracker: Peak memory usage to apply mutate/merge in 9c0d5b40-996d-41ff-8c86-fa215963e638::202211_1_91_18: 4.14 MiB.
2022.11.04 01:33:56.917805 [ 346 ] {} <Trace> SystemLog (system.trace_log): Flushing system log, 246 entries to flush up to offset 6953
2022.11.04 01:33:56.919734 [ 346 ] {} <Trace> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.04 01:33:56.919778 [ 346 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 83.24 GiB.
2022.11.04 01:33:56.920418 [ 346 ] {} <Trace> MergedBlockOutputStream: filled checksums 202211_80_80_0 (state Temporary)
2022.11.04 01:33:56.920682 [ 346 ] {} <Trace> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029): Renaming temporary part tmp_insert_202211_80_80_0 to 202211_80_80_0.
2022.11.04 01:33:56.920867 [ 242 ] {} <Debug> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029) (MergerMutator): Selected 6 parts from 202211_1_75_15 to 202211_80_80_0
2022.11.04 01:33:56.920949 [ 242 ] {} <Trace> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.04 01:33:56.920956 [ 346 ] {} <Trace> SystemLog (system.trace_log): Flushed system log up to offset 6953
2022.11.04 01:33:56.921079 [ 242 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 83.24 GiB.
2022.11.04 01:33:56.921208 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTask::PrepareStage: Merging 6 parts: from 202211_1_75_15 to 202211_80_80_0 into Compact
2022.11.04 01:33:56.921649 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTask::PrepareStage: Selected MergeAlgorithm: Horizontal
2022.11.04 01:33:56.921719 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_1_75_15, total 6559 rows starting from the beginning of the part
2022.11.04 01:33:56.922036 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_76_76_0, total 22 rows starting from the beginning of the part
2022.11.04 01:33:56.922313 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_77_77_0, total 22 rows starting from the beginning of the part
2022.11.04 01:33:56.922519 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_78_78_0, total 84 rows starting from the beginning of the part
2022.11.04 01:33:56.922740 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_79_79_0, total 20 rows starting from the beginning of the part
2022.11.04 01:33:56.922985 [ 184 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTreeSequentialSource: Reading 2 marks from part 202211_80_80_0, total 246 rows starting from the beginning of the part
2022.11.04 01:33:56.930204 [ 186 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Debug> MergeTask::MergeProjectionsStage: Merge sorted 6953 rows, containing 10 columns (10 merged, 0 gathered) in 0.009060217 sec., 767420.9127662174 rows/sec., 231.85 MiB/sec.
2022.11.04 01:33:56.933116 [ 186 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Trace> MergedBlockOutputStream: filled checksums 202211_1_80_16 (state Temporary)
2022.11.04 01:33:56.933522 [ 186 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Trace> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029): Renaming temporary part tmp_merge_202211_1_80_16 to 202211_1_80_16.
2022.11.04 01:33:56.933624 [ 186 ] {3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16} <Trace> system.trace_log (3b519027-c1c8-4622-9b70-b16195d25029) (MergerMutator): Merged 6 parts: from 202211_1_75_15 to 202211_80_80_0
2022.11.04 01:33:56.933806 [ 186 ] {} <Debug> MemoryTracker: Peak memory usage to apply mutate/merge in 3b519027-c1c8-4622-9b70-b16195d25029::202211_1_80_16: 8.24 MiB.
2022.11.04 01:33:57.000137 [ 363 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 3.30 GiB, peak 10.92 GiB, free memory in arenas 0.00 B, will set to 3.49 GiB (RSS), difference: 201.19 MiB
2022.11.04 01:33:57.401347 [ 3085 ] {} <Fatal> BaseDaemon: 2. __sanitizer::Die() @ 0x1632aaf6 in /workspace/clickhouse
2022.11.04 01:33:58.000137 [ 363 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 3.49 GiB, peak 10.92 GiB, free memory in arenas 0.00 B, will set to 3.72 GiB (RSS), difference: 235.19 MiB
2022.11.04 01:33:58.463086 [ 3085 ] {} <Fatal> BaseDaemon: 3. ? @ 0x1633acb3 in /workspace/clickhouse
2022.11.04 01:33:58.476017 [ 3085 ] {} <Fatal> BaseDaemon: 4. ./build_docker/../src/Parsers/ASTSelectQuery.cpp:122: DB::ASTSelectQuery::formatImpl(DB::IAST::FormatSettings const&, DB::IAST::FormatState&, DB::IAST::FormatStateStacked) const @ 0x2df1323f in /workspace/clickhouse
2022.11.04 01:33:58.523902 [ 3085 ] {} <Fatal> BaseDaemon: 5.1. inlined from ./build_docker/../contrib/libcxx/include/__tree:1088: std::__1::__tree<std::__1::tuple<DB::IAST const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::pair<unsigned long, unsigned long>>, std::__1::less<std::__1::tuple<DB::IAST const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::pair<unsigned long, unsigned long>>>, std::__1::allocator<std::__1::tuple<DB::IAST const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::pair<unsigned long, unsigned long>>>>::__root[abi:v15003]() const
2022.11.04 01:33:58.523993 [ 3085 ] {} <Fatal> BaseDaemon: 5.2. inlined from ./build_docker/../contrib/libcxx/include/__tree:1788: ~__tree
2022.11.04 01:33:58.524021 [ 3085 ] {} <Fatal> BaseDaemon: 5.3. inlined from ./build_docker/../contrib/libcxx/include/set:676: ~set
2022.11.04 01:33:58.524052 [ 3085 ] {} <Fatal> BaseDaemon: 5.4. inlined from ./build_docker/../src/Parsers/IAST.h:209: ~FormatState
2022.11.04 01:33:58.524081 [ 3085 ] {} <Fatal> BaseDaemon: 5. ./build_docker/../src/Parsers/IAST.h:235: DB::IAST::format(DB::IAST::FormatSettings const&) const @ 0x2a5597a1 in /workspace/clickhouse
2022.11.04 01:33:58.530855 [ 3085 ] {} <Fatal> BaseDaemon: 6. ./build_docker/../src/Parsers/formatAST.cpp:13: DB::formatAST(DB::IAST const&, DB::WriteBuffer&, bool, bool) @ 0x2e0379d6 in /workspace/clickhouse
2022.11.04 01:33:58.537664 [ 3085 ] {} <Fatal> BaseDaemon: 7. ./build_docker/../src/Parsers/formatAST.cpp:0: DB::serializeAST(DB::IAST const&, bool) @ 0x2e037a3c in /workspace/clickhouse
2022.11.04 01:33:58.542946 [ 3085 ] {} <Fatal> BaseDaemon: 8. ./build_docker/../src/Parsers/queryToString.cpp:8: DB::queryToString(std::__1::shared_ptr<DB::IAST> const&) @ 0x2e04552a in /workspace/clickhouse
2022.11.04 01:33:58.600429 [ 3085 ] {} <Fatal> BaseDaemon: 9. ./build_docker/../src/Interpreters/TreeRewriter.cpp:0: DB::TreeRewriterResult::collectUsedColumns(std::__1::shared_ptr<DB::IAST> const&, bool, bool) @ 0x2c1e9d5f in /workspace/clickhouse
2022.11.04 01:33:58.662858 [ 3085 ] {} <Fatal> BaseDaemon: 10. ./build_docker/../src/Interpreters/TreeRewriter.cpp:0: DB::TreeRewriter::analyzeSelect(std::__1::shared_ptr<DB::IAST>&, DB::TreeRewriterResult&&, DB::SelectQueryOptions const&, std::__1::vector<DB::TableWithColumnNamesAndTypes, std::__1::allocator<DB::TableWithColumnNamesAndTypes>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::TableJoin>) const @ 0x2c1ef576 in /workspace/clickhouse
2022.11.04 01:33:58.757346 [ 3085 ] {} <Fatal> BaseDaemon: 11. ./build_docker/../src/Storages/StorageMerge.cpp:411: DB::ReadFromMerge::initializePipeline(DB::QueryPipelineBuilder&, DB::BuildQueryPipelineSettings const&) @ 0x2ca60cd1 in /workspace/clickhouse
2022.11.04 01:33:58.771826 [ 3085 ] {} <Fatal> BaseDaemon: 12. ./build_docker/../src/Processors/QueryPlan/ISourceStep.cpp:0: DB::ISourceStep::updatePipeline(std::__1::vector<std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>, std::__1::allocator<std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>>>, DB::BuildQueryPipelineSettings const&) @ 0x2db80e7d in /workspace/clickhouse
2022.11.04 01:33:58.800743 [ 3085 ] {} <Fatal> BaseDaemon: 13.1. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:296: std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>::release[abi:v15003]()
2022.11.04 01:33:58.800810 [ 3085 ] {} <Fatal> BaseDaemon: 13.2. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:225: std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>::operator=[abi:v15003](std::__1::unique_ptr<DB::QueryPipelineBuilder, std::__1::default_delete<DB::QueryPipelineBuilder>>&&)
2022.11.04 01:33:58.800837 [ 3085 ] {} <Fatal> BaseDaemon: 13. ./build_docker/../src/Processors/QueryPlan/QueryPlan.cpp:187: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x2dbaadbc in /workspace/clickhouse
2022.11.04 01:33:58.841440 [ 3085 ] {} <Fatal> BaseDaemon: 14. ./build_docker/../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:370: DB::InterpreterSelectWithUnionQuery::execute() @ 0x2be97885 in /workspace/clickhouse
2022.11.04 01:33:58.900585 [ 3085 ] {} <Fatal> BaseDaemon: 15. ./build_docker/../src/Interpreters/executeQuery.cpp:0: DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x2c2f3f1a in /workspace/clickhouse
2022.11.04 01:33:58.963933 [ 3085 ] {} <Fatal> BaseDaemon: 16. ./build_docker/../src/Interpreters/executeQuery.cpp:1106: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x2c2ef8ec in /workspace/clickhouse
2022.11.04 01:33:59.000149 [ 363 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 3.72 GiB, peak 10.92 GiB, free memory in arenas 0.00 B, will set to 3.78 GiB (RSS), difference: 56.36 MiB
2022.11.04 01:33:59.020006 [ 3085 ] {} <Fatal> BaseDaemon: 17. ./build_docker/../src/Server/TCPHandler.cpp:374: DB::TCPHandler::runImpl() @ 0x2d49f330 in /workspace/clickhouse
2022.11.04 01:33:59.087231 [ 3085 ] {} <Fatal> BaseDaemon: 18. ./build_docker/../src/Server/TCPHandler.cpp:1904: DB::TCPHandler::run() @ 0x2d4bfe3a in /workspace/clickhouse
2022.11.04 01:33:59.092680 [ 3085 ] {} <Fatal> BaseDaemon: 19. ./build_docker/../contrib/poco/Net/src/TCPServerConnection.cpp:57: Poco::Net::TCPServerConnection::start() @ 0x2e48bb6c in /workspace/clickhouse
2022.11.04 01:33:59.100015 [ 3085 ] {} <Fatal> BaseDaemon: 20.1. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:48: std::__1::default_delete<Poco::Net::TCPServerConnection>::operator()[abi:v15003](Poco::Net::TCPServerConnection*) const
2022.11.04 01:33:59.100072 [ 3085 ] {} <Fatal> BaseDaemon: 20.2. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:305: std::__1::unique_ptr<Poco::Net::TCPServerConnection, std::__1::default_delete<Poco::Net::TCPServerConnection>>::reset[abi:v15003](Poco::Net::TCPServerConnection*)
2022.11.04 01:33:59.100098 [ 3085 ] {} <Fatal> BaseDaemon: 20.3. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:259: ~unique_ptr
2022.11.04 01:33:59.100126 [ 3085 ] {} <Fatal> BaseDaemon: 20. ./build_docker/../contrib/poco/Net/src/TCPServerDispatcher.cpp:116: Poco::Net::TCPServerDispatcher::run() @ 0x2e48c05a in /workspace/clickhouse
2022.11.04 01:33:59.108310 [ 3085 ] {} <Fatal> BaseDaemon: 21. ./build_docker/../contrib/poco/Foundation/src/ThreadPool.cpp:213: Poco::PooledThread::run() @ 0x2e603a27 in /workspace/clickhouse
2022.11.04 01:33:59.115697 [ 3085 ] {} <Fatal> BaseDaemon: 22.1. inlined from ./build_docker/../contrib/poco/Foundation/include/Poco/SharedPtr.h:156: Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable>>::assign(Poco::Runnable*)
2022.11.04 01:33:59.115749 [ 3085 ] {} <Fatal> BaseDaemon: 22.2. inlined from ./build_docker/../contrib/poco/Foundation/include/Poco/SharedPtr.h:208: Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable>>::operator=(Poco::Runnable*)
2022.11.04 01:33:59.115775 [ 3085 ] {} <Fatal> BaseDaemon: 22. ./build_docker/../contrib/poco/Foundation/src/Thread_POSIX.cpp:360: Poco::ThreadImpl::runnableEntry(void*) @ 0x2e60150f in /workspace/clickhouse
2022.11.04 01:33:59.115803 [ 3085 ] {} <Fatal> BaseDaemon: 23. ? @ 0x7f686df67609 in ?
2022.11.04 01:33:59.115824 [ 3085 ] {} <Fatal> BaseDaemon: 24. clone @ 0x7f686de8c133 in ?
2022.11.04 01:33:59.285366 [ 148 ] {} <Trace> KeeperTCPHandler: Received heartbeat for session #1
2022.11.04 01:33:59.432149 [ 3085 ] {} <Fatal> BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read. (calculated checksum: 896D5876356205E455540B520D18BD77)
```
{
    return getFirstTableJoin(*this);
}
bool ASTSelectQuery::hasJoin() const
{
    if (!tables())
        return false;
    const auto & tables_in_select_query = tables()->as<ASTTablesInSelectQuery &>();
    if (tables_in_select_query.children.empty())
        return false;
    for (const auto & child : tables_in_select_query.children)
    {
        const auto & tables_element = child->as<ASTTablesInSelectQueryElement &>();
        if (tables_element.table_join)
            return true;
    }
    return false;
}
static String getTableExpressionAlias(const ASTTableExpression * table_expression)
{
    if (table_expression->subquery)
        return table_expression->subquery->tryGetAlias();
    else if (table_expression->table_function)
        return table_expression->table_function->tryGetAlias();
    else if (table_expression->database_and_table_name)
        return table_expression->database_and_table_name->tryGetAlias();
    return String();
}
void ASTSelectQuery::replaceDatabaseAndTable(const String & database_name, const String & table_name)