diff --git a/src/Core/SortCursor.h b/src/Core/SortCursor.h index 2e837292016..9dae1059fb4 100644 --- a/src/Core/SortCursor.h +++ b/src/Core/SortCursor.h @@ -552,16 +552,13 @@ private: }; template -using SortingHeap = SortingQueueImpl; - -template -using SortingQueueDefault = SortingQueueImpl; +using SortingQueue = SortingQueueImpl; template using SortingQueueBatch = SortingQueueImpl; /** SortQueueVariants allow to specialize sorting queue for concrete types and sort description. - * To access default queue variant callOnDefaultVariant method must be used. + * To access queue variant callOnVariant method must be used. * To access batch queue variant callOnBatchVariant method must be used. */ class SortQueueVariants @@ -617,7 +614,7 @@ public: } template - decltype(auto) callOnDefaultVariant(Func && func) + decltype(auto) callOnVariant(Func && func) { return std::visit(func, default_queue_variants); } @@ -630,16 +627,16 @@ public: bool variantSupportJITCompilation() const { - return std::holds_alternative>(default_queue_variants) - || std::holds_alternative>(default_queue_variants) - || std::holds_alternative>(default_queue_variants); + return std::holds_alternative>(default_queue_variants) + || std::holds_alternative>(default_queue_variants) + || std::holds_alternative>(default_queue_variants); } private: template void initializeQueues() { - default_queue_variants = SortingQueueDefault(); + default_queue_variants = SortingQueue(); batch_queue_variants = SortingQueueBatch(); } diff --git a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.cpp b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.cpp index 1d0be726c16..68170924840 100644 --- a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.cpp +++ b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.cpp @@ -22,7 +22,7 @@ void IMergingAlgorithmWithDelayedChunk::initializeQueue(Inputs inputs) header, current_inputs[source_num].chunk.getColumns(), description, source_num, current_inputs[source_num].permutation); } - queue = SortingHeap(cursors); + queue = SortingQueue(cursors); } void IMergingAlgorithmWithDelayedChunk::updateCursor(Input & input, size_t source_num) diff --git a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.h b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.h index e9f735f4a71..a8c5730cdb3 100644 --- a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.h +++ b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithDelayedChunk.h @@ -13,7 +13,7 @@ public: IMergingAlgorithmWithDelayedChunk(Block header_, size_t num_inputs, SortDescription description_); protected: - SortingHeap queue; + SortingQueue queue; SortDescription description; /// Previous row. May refer to last_chunk_sort_columns or row from source_chunks. diff --git a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.cpp b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.cpp index 2e87de1ae29..8c94a017271 100644 --- a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.cpp +++ b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.cpp @@ -43,7 +43,7 @@ void IMergingAlgorithmWithSharedChunks::initialize(Inputs inputs) source.chunk->sort_columns = cursors[source_num].sort_columns; } - queue = SortingHeap(cursors); + queue = SortingQueue(cursors); } void IMergingAlgorithmWithSharedChunks::consume(Input & input, size_t source_num) diff --git a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.h b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.h index 32ef23ab6e5..58c445b6ac4 100644 --- a/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.h +++ b/src/Processors/Merges/Algorithms/IMergingAlgorithmWithSharedChunks.h @@ -36,7 +36,7 @@ protected: using Sources = std::vector; Sources sources; - SortingHeap queue; + SortingQueue queue; /// Used in Vertical merge algorithm to gather non-PK/non-index columns (on next step) /// If it is not nullptr then it should be populated during execution diff --git a/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.cpp b/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.cpp index 570f101ae34..e22628c8dcd 100644 --- a/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.cpp +++ b/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.cpp @@ -74,7 +74,7 @@ void MergingSortedAlgorithm::initialize(Inputs inputs) cursors[source_num] = SortCursorImpl(header, chunk.getColumns(), description, source_num); } - queue_variants.callOnDefaultVariant([&](auto & queue) + queue_variants.callOnVariant([&](auto & queue) { using QueueType = std::decay_t; queue = QueueType(cursors); @@ -87,7 +87,7 @@ void MergingSortedAlgorithm::consume(Input & input, size_t source_num) current_inputs[source_num].swap(input); cursors[source_num].reset(current_inputs[source_num].chunk.getColumns(), header); - queue_variants.callOnDefaultVariant([&](auto & queue) + queue_variants.callOnVariant([&](auto & queue) { queue.push(cursors[source_num]); }); @@ -95,7 +95,7 @@ void MergingSortedAlgorithm::consume(Input & input, size_t source_num) IMergingAlgorithm::Status MergingSortedAlgorithm::merge() { - IMergingAlgorithm::Status result = queue_variants.callOnDefaultVariant([&](auto & queue) + IMergingAlgorithm::Status result = queue_variants.callOnVariant([&](auto & queue) { return mergeImpl(queue); }); @@ -103,8 +103,8 @@ IMergingAlgorithm::Status MergingSortedAlgorithm::merge() return result; } -template -IMergingAlgorithm::Status MergingSortedAlgorithm::mergeImpl(TSortingHeap & queue) +template +IMergingAlgorithm::Status MergingSortedAlgorithm::mergeImpl(TSortingQueue & queue) { /// Take rows in required order and put them into `merged_data`, while the rows are no more than `max_block_size` while (queue.isValid()) diff --git a/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.h b/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.h index 44041775a74..cd06220cbc5 100644 --- a/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.h +++ b/src/Processors/Merges/Algorithms/MergingSortedAlgorithm.h @@ -53,8 +53,8 @@ private: Status insertFromChunk(size_t source_num); - template - Status mergeImpl(TSortingHeap & queue); + template + Status mergeImpl(TSortingQueue & queue); }; } diff --git a/src/Processors/Transforms/SortingTransform.cpp b/src/Processors/Transforms/SortingTransform.cpp index 7c58e840cfe..87008907a60 100644 --- a/src/Processors/Transforms/SortingTransform.cpp +++ b/src/Processors/Transforms/SortingTransform.cpp @@ -73,8 +73,8 @@ Chunk MergeSorter::read() } -template -Chunk MergeSorter::mergeBatchImpl(TSortingHeap & queue) +template +Chunk MergeSorter::mergeBatchImpl(TSortingQueue & queue) { size_t num_columns = chunks[0].getNumColumns(); MutableColumns merged_columns = chunks[0].cloneEmptyColumns(); diff --git a/src/Processors/Transforms/SortingTransform.h b/src/Processors/Transforms/SortingTransform.h index 13ab13fcfab..a607e52550d 100644 --- a/src/Processors/Transforms/SortingTransform.h +++ b/src/Processors/Transforms/SortingTransform.h @@ -34,8 +34,8 @@ private: /** Two different cursors are supported - with and without Collation. * Templates are used (instead of virtual functions in SortCursor) for zero-overhead. */ - template - Chunk mergeBatchImpl(TSortingHeap & queue); + template + Chunk mergeBatchImpl(TSortingQueue & queue); };