Using optimization of single column sort in Processors

This commit is contained in:
Alexey Milovidov 2019-12-22 12:55:43 +03:00
parent b4ba1becd4
commit 53606c6e8f
2 changed files with 11 additions and 5 deletions

View File

@ -40,10 +40,12 @@ MergeSorter::MergeSorter(Chunks chunks_, SortDescription & description_, size_t
chunks.swap(nonempty_chunks);
if (!has_collation)
if (has_collation)
queue_with_collation = SortingHeap<SortCursorWithCollation>(cursors);
else if (description.size() > 1)
queue_without_collation = SortingHeap<SortCursor>(cursors);
else
queue_with_collation = SortingHeap<SortCursorWithCollation>(cursors);
queue_simple = SortingHeap<SimpleSortCursor>(cursors);
}
@ -59,9 +61,12 @@ Chunk MergeSorter::read()
return res;
}
return !has_collation
? mergeImpl(queue_without_collation)
: mergeImpl(queue_with_collation);
if (has_collation)
return mergeImpl(queue_with_collation);
else if (description.size() > 1)
return mergeImpl(queue_without_collation);
else
return mergeImpl(queue_simple);
}

View File

@ -32,6 +32,7 @@ private:
bool has_collation = false;
SortingHeap<SortCursor> queue_without_collation;
SortingHeap<SimpleSortCursor> queue_simple;
SortingHeap<SortCursorWithCollation> queue_with_collation;
/** Two different cursors are supported - with and without Collation.