Repository navigation
Closed
Labels
bugConfirmed user-visible misbehaviour in official releasecomp-skip-indexSkipping indexes (minmax, set, bloom) and their evaluation.fuzzProblem found by one of the fuzzers
Description
Describe the bug
This one happens since v25.5 with set index, and with query_plan_merge_expressions = 0. It may be different from the others.
How to reproduce
Error message and/or stacktrace
Stack trace:
<Fatal> : Logical error: 'Unexpected return type from equals. Expected Nullable(UInt8). Got UInt8. Action:
FUNCTION equals(c0 :: 0, 0 :: 1) -> equals(c0, 0) Nullable(UInt8) : 2,
input block structure:c0 Int32 Int32(size = 1), 0 UInt8 Const(size = 1, UInt8(size = 1))'.
<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) @ 0x0000000024ab61f2
1. src/Common/Exception.cpp:129: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000014fc97e9
2. src/Common/Exception.h:123: DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000d55fcce
3. src/Common/Exception.h:58: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000d55f6d1
4. src/Common/Exception.h:141: DB::Exception::Exception<String, String, String, String, String>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String>::type, std::type_identity<String>::type, std::type_identity<String>::type, std::type_identity<String>::type>, String&&, String&&, String&&, String&&, String&&) @ 0x000000000fc6e004
5. src/Interpreters/ExpressionActions.cpp:696: DB::ExpressionActions::execute(DB::Block&, unsigned long&, bool, bool) const @ 0x000000001ac80cc0
6. src/Interpreters/ExpressionActions.cpp:882: DB::ExpressionActions::execute(DB::Block&, bool, bool) const @ 0x000000001ac81346
7. src/Storages/MergeTree/MergeTreeIndexSet.cpp:452: DB::MergeTreeIndexConditionSet::getPossibleGranules(std::shared_ptr<DB::IMergeTreeIndexBulkGranules> const&) const @ 0x000000001e4c1c30
8. src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1815: DB::MergeTreeDataSelectExecutor::filterMarksUsingIndex(std::shared_ptr<DB::IMergeTreeIndex const>, std::shared_ptr<DB::IMergeTreeIndexCondition>, std::shared_ptr<DB::IMergeTreeDataPart const>, DB::MarkRanges const&, DB::RangesInDataPartReadHints const&, DB::MergeTreeReaderSettings const&, DB::MarkCache*, DB::UncompressedCache*, DB::VectorSimilarityIndexCache*, std::shared_ptr<Poco::Logger>) @ 0x000000001e454924
9. src/Storages/MergeTree/MergeTreeIndexReadResultPool.cpp:57: DB::MergeTreeSkipIndexReader::read(DB::RangesInDataPart const&) @ 0x000000001e572504
10. src/Storages/MergeTree/MergeTreeIndexReadResultPool.cpp:461: DB::MergeTreeIndexReadResultPool::getOrBuildIndexReadResult(DB::RangesInDataPart const&, DB::RangesInDataParts const&) @ 0x000000001e574234
11. src/Storages/MergeTree/MergeTreeSelectProcessor.cpp:112: DB::MergeTreeIndexBuildContext::getPreparedIndexReadResult(DB::MergeTreeReadTask const&) const @ 0x000000001e56c4fd
12. src/Storages/MergeTree/MergeTreeReadTask.cpp:272: DB::MergeTreeReadTask::initializeIndexReader(DB::MergeTreeIndexBuildContext const&) @ 0x000000001e55fe1b
13. src/Storages/MergeTree/MergeTreeReadTask.cpp:256: DB::MergeTreeReadTask::initializeReadersChain(DB::PrewhereExprInfo const&, std::shared_ptr<DB::MergeTreeIndexBuildContext>, DB::ReadStepsPerformanceCounters&) @ 0x000000001e55fb1f
14. src/Storages/MergeTree/MergeTreeSelectProcessor.cpp:347: DB::MergeTreeSelectProcessor::read() @ 0x000000001e56ed4f
15. src/Storages/MergeTree/MergeTreeSource.cpp:229: DB::MergeTreeSource::tryGenerate() @ 0x000000001f1655e9
16. src/Processors/ISource.cpp:110: DB::ISource::work() @ 0x000000001eb826c2
17. src/Processors/Executors/ExecutionThreadContext.cpp:53: DB::ExecutionThreadContext::executeTask() @ 0x000000001eb9fad0
18. src/Processors/Executors/PipelineExecutor.cpp:351: DB::PipelineExecutor::executeStepImpl(unsigned long, DB::IAcquiredSlot*, std::atomic<bool>*) @ 0x000000001eb91858
19. src/Processors/Executors/PipelineExecutor.cpp:279: DB::PipelineExecutor::executeSingleThread(unsigned long, DB::IAcquiredSlot*) @ 0x000000001eb91e69
20. src/Processors/Executors/PipelineExecutor.cpp:602: DB::PipelineExecutor::executeImpl(unsigned long, bool) @ 0x000000001eb90761
21. src/Processors/Executors/PipelineExecutor.cpp:136: DB::PipelineExecutor::execute(unsigned long, bool) @ 0x000000001eb8fe7f
22. src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:76: void std::__function::__policy_invoker<void ()>::__call_impl[abi:se190107]<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true, true>::ThreadFromGlobalPoolImpl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x000000001eba7fe4
23. contrib/llvm-project/libcxx/include/__functional/function.h:716: ? @ 0x000000001510a6e6
24. contrib/llvm-project/libcxx/include/__type_traits/invoke.h:117: void* std::__thread_proxy[abi:se190107]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x0000000015111100
25. ? @ 0x00000000000a3d64
26. __clone3 @ 0x00000000001373bc
Version info
- Resolved by: Add regression test for set index under MV layer type change (#89802) #105552
- Merged into:
26.8.1.330(included in26.8and later)
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official releasecomp-skip-indexSkipping indexes (minmax, set, bloom) and their evaluation.fuzzProblem found by one of the fuzzers
Activity
Apply type corrections for all filled joins, not just StorageJoin
alexey-milovidov commentedon Feb 11, 2026
Possibly related fix: #95098
alexey-milovidov commentedon Mar 2, 2026
Tested on current master (ed6302e) with
clickhouse-local. The issue is still reproducible:PedroTadim commentedon May 21, 2026
@groeneai can you fix this?
groeneai commentedon May 21, 2026
Filed a fix in #105552.
Root cause:
MergeTreeIndexConditionSetreused the predicate'sequalsfunction whoseresult_typewas resolved against the MV layer'sNullable(Int32)input. The granule block carries the storage column at the storage type (Int32), soExpressionActions::executeranequalson(Int32, UInt8)->UInt8and failed the result-type invariant check againstNullable(UInt8).The fix looks up the granule type for each key column from
index_description.sample_block, adds anINPUTof that type, andCASTs it back to the predicate's expected type before any downstream pre-resolved function reads it. Regression test added attests/queries/0_stateless/04272_89802_set_index_mv_nullable_column_type.sql— without the fix the new test crashes the debug server; with it the test passes 30 consecutive runs and the existing 10 statelessset-index tests all pass.Fix logical error in disjunction filter push-down through JOIN with t…
Reduce PR ClickHouse#105552 to regression test only; bug fixed upstream
Fix LOGICAL_ERROR in MergeTreeIndexConditionSet under MV layer type c…
Merge pull request ClickHouse#105552 from groeneai/groeneai/fix-89802…