Skip to content

Logical Error: Block structure mismatch in UnionStep stream (due to a projection) #83614

@PedroTadim

Description

@PedroTadim

Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels.

Test name: Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6)
CI report: AST fuzzer (amd_debug)
CIDB statistics: cidb

Describe the bug

From this run: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=83596&sha=26956394811f37c8273cbdb30bf4cfd2d44464f5&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29 Happens since v25.1. For some reason, the projection is not used in versions prior to that one.

How to reproduce

Simplified in this Fiddle: https://fiddle.clickhouse.com/2bdd510b-aded-43e3-8ab1-17014977341b

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'Block structure mismatch in UnionStep stream: different number of columns:
i Int32 Int32(size = 0)
'.
<Fatal> : Stack trace (when copying this message, always include the lines below):

0. std::exception::exception[abi:ne190107]() @ 0x0000000019b82054
1. ci/tmp/build/./base/poco/Foundation/src/Exception.cpp:27: Poco::Exception::Exception(String const&, int) @ 0x000000003e3612c0
2. ci/tmp/build/./src/Common/Exception.cpp:115: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000027bff70b
3. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x0000000019a24116
4. src/Common/Exception.h:137: void DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::basic_string_view<char, std::char_traits<char>>, bool) @ 0x00000000309bbafa
5. ci/tmp/build/./src/Processors/QueryPlan/UnionStep.cpp:26: DB::UnionStep::updateOutputHeader() @ 0x00000000385049cc
6. ci/tmp/build/./src/Processors/QueryPlan/UnionStep.cpp:34: DB::UnionStep::UnionStep(std::vector<DB::Block, std::allocator<DB::Block>>, unsigned long) @ 0x000000003850480b
7. contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:634: std::__unique_if<DB::UnionStep>::__unique_single std::make_unique[abi:ne190107]<DB::UnionStep, std::vector<DB::Block, std::allocator<DB::Block>>>(std::vector<DB::Block, std::allocator<DB::Block>>&&) @ 0x000000003859b85a
8. ci/tmp/build/./src/Processors/QueryPlan/Optimizations/optimizeUseNormalProjection.cpp:415: DB::QueryPlanOptimizations::optimizeUseNormalProjections(std::vector<DB::QueryPlanOptimizations::Frame, std::allocator<DB::QueryPlanOptimizations::Frame>>&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&) @ 0x0000000038598f34
9. ci/tmp/build/./src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:265: DB::QueryPlanOptimizations::optimizeTreeSecondPass(DB::QueryPlanOptimizationSettings const&, DB::QueryPlan::Node&, std::list<DB::QueryPlan::Node, std::allocator<DB::QueryPlan::Node>>&, DB::QueryPlan&) @ 0x000000003851d45a
10. ci/tmp/build/./src/Processors/QueryPlan/QueryPlan.cpp:496: DB::QueryPlan::optimize(DB::QueryPlanOptimizationSettings const&) @ 0x00000000383c1a84
11. ci/tmp/build/./src/Processors/QueryPlan/QueryPlan.cpp:175: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&, bool) @ 0x00000000383c1097
12. ci/tmp/build/./src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:289: DB::InterpreterSelectQueryAnalyzer::buildQueryPipeline() @ 0x0000000032c2ac33
13. ci/tmp/build/./src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:256: DB::InterpreterSelectQueryAnalyzer::execute() @ 0x0000000032c2a806
14. ci/tmp/build/./src/Interpreters/executeQuery.cpp:1561: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>) @ 0x00000000330f1f5b
15. ci/tmp/build/./src/Interpreters/executeQuery.cpp:1769: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x00000000330eba7c
16. ci/tmp/build/./src/Server/TCPHandler.cpp:723: DB::TCPHandler::runImpl() @ 0x000000003779b111
17. ci/tmp/build/./src/Server/TCPHandler.cpp:2730: DB::TCPHandler::run() @ 0x00000000377cd1cd
18. ci/tmp/build/./base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000003e48fe42
19. ci/tmp/build/./base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000003e490b12
20. ci/tmp/build/./base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000003e3f5d17
21. base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000003e3f156e
22. start_thread @ 0x00000000000a2ef1
23. __clone3 @ 0x000000000013445c

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official releasecomp-projectionsProjections: precomputed layouts for accelerating queries (projection parts, maintenance).fuzzProblem found by one of the fuzzersred CIVERY flaky testtestingSpecial issue with list of bugs found by CI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions