SortingTransform add cursor order

This commit is contained in:
Maksim Kita 2022-06-15 19:24:39 +02:00
parent d82ab22333
commit c86191a6b9
2 changed files with 8 additions and 3 deletions

View File

@ -435,7 +435,9 @@ public:
if constexpr (strategy == SortingQueueStrategy::Batch)
{
if (!queue.empty())
if (queue.empty())
batch_size = 0;
else
updateBatchSize();
}
}

View File

@ -26,8 +26,11 @@ MergeSorter::MergeSorter(const Block & header, Chunks chunks_, SortDescription &
: chunks(std::move(chunks_)), description(description_), max_merged_block_size(max_merged_block_size_), limit(limit_), queue_variants(header, description)
{
Chunks nonempty_chunks;
for (auto & chunk : chunks)
size_t chunks_size = chunks.size();
for (size_t chunk_index = 0; chunk_index < chunks_size; ++chunk_index)
{
auto & chunk = chunks[chunk_index];
if (chunk.getNumRows() == 0)
continue;
@ -36,7 +39,7 @@ MergeSorter::MergeSorter(const Block & header, Chunks chunks_, SortDescription &
/// which can be inefficient.
convertToFullIfSparse(chunk);
cursors.emplace_back(header, chunk.getColumns(), description);
cursors.emplace_back(header, chunk.getColumns(), description, chunk_index);
has_collation |= cursors.back().has_collation;
nonempty_chunks.emplace_back(std::move(chunk));