Skip to content

Another Logical error: 'Rows are not sorted with permutation` #90028

Description

@PedroTadim

Describe the bug

Doesn't look like the same as #88138 cc @GrigoryPervakov and @rienath one of you can look at this?

How to reproduce

With Qbit type enabled, run on a debug build:

SET allow_experimental_qbit_type = 1;
CREATE TABLE t0 (c0 QBit(Float32, 10), c1 Int) ENGINE = SummingMergeTree() PRIMARY KEY tuple();
INSERT INTO TABLE t0 (c0, c1) SELECT [-40, CAST(number % 66 AS Float32), 63, CAST(number % 24 AS Float32), CAST(number AS Float32), CAST((-number) AS Float32), CAST((-number) % 24 AS Float32), CAST((-number) % 24 AS Float32), 5, CAST((-number) AS Float32)], 58 FROM numbers(43);
INSERT INTO TABLE t0 (c1, c0) SELECT 49, [CAST(number % 60 AS Float32), CAST(number AS Float32), CAST(number AS Float32), CAST((-number) % 22 AS Float32), CAST(number AS Float32), CAST(number AS Float32), CAST((-number) AS Float32), CAST((-number) AS Float32), CAST(number AS Float32), 57] FROM numbers(48);
SELECT c0 FROM t0 FINAL ORDER BY c0, c1;

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'Rows are not sorted with permutation, position 2, previous_row index 0, current_row index 65'.
<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) @ 0x0000000024e3d7b2
1. src/Common/Exception.cpp:129: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000015157969
2. src/Common/Exception.h:123: DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000d49af8e
3. src/Common/Exception.h:58: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000d49aad1
4. src/Common/Exception.h:141: DB::Exception::Exception<unsigned long&, unsigned long const&, unsigned long const&>(int, FormatStringHelperImpl<std::type_identity<unsigned long&>::type, std::type_identity<unsigned long const&>::type, std::type_identity<unsigned long const&>::type>, unsigned long&, unsigned long const&, unsigned long const&) @ 0x0000000017244cf6
5. src/Interpreters/sortBlock.cpp:295: DB::(anonymous namespace)::checkSortedWithPermutation(DB::Block const&, DB::SortDescription const&, unsigned long, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 63ul, 64ul> const&) @ 0x000000001b59d78b
6. src/Interpreters/sortBlock.cpp:346: DB::sortBlock(DB::Block&, DB::SortDescription const&, unsigned long, DB::IColumn::PermutationSortStability) @ 0x000000001b59ca74
7. src/Processors/Transforms/PartialSortingTransform.cpp:137: DB::PartialSortingTransform::transform(DB::Chunk&) @ 0x000000001eeabe0a
8. src/Processors/ISimpleTransform.h:33: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x000000001775afd3
9. src/Processors/ISimpleTransform.cpp:98: DB::ISimpleTransform::work() @ 0x000000001ebb670a
10. src/Processors/Executors/ExecutionThreadContext.cpp:53: DB::ExecutionThreadContext::executeTask() @ 0x000000001ebd4330
11. src/Processors/Executors/PipelineExecutor.cpp:351: DB::PipelineExecutor::executeStepImpl(unsigned long, DB::IAcquiredSlot*, std::atomic<bool>*) @ 0x000000001ebc6b58
12. src/Processors/Executors/PipelineExecutor.cpp:279: DB::PipelineExecutor::executeSingleThread(unsigned long, DB::IAcquiredSlot*) @ 0x000000001ebc7169
13. src/Processors/Executors/PipelineExecutor.cpp:565: void std::__function::__policy_func<void ()>::__call_func[abi:se210105]<DB::PipelineExecutor::spawnThreads(std::shared_ptr<DB::IAcquiredSlot>)::$_0>(std::__function::__policy_storage const*) @ 0x000000001ebc8281
14. contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x00000000152a5536
15. contrib/llvm-project/libcxx/include/__type_traits/invoke.h:217: ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*&&)::'lambda'()::operator()() @ 0x00000000152ab8e6
16. contrib/llvm-project/libcxx/include/__functional/function.h:508: ? @ 0x00000000152a2972
17. contrib/llvm-project/libcxx/include/__type_traits/invoke.h:217: void* std::__thread_proxy[abi:se210105]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x00000000152a9480
18. ? @ 0x00000000000a3d64
19. __clone3 @ 0x00000000001373bc

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official releasefuzzProblem found by one of the fuzzers

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions