Github user vrozov commented on the issue:
https://github.com/apache/drill/pull/1075
The scenario when all batches can be merged in memory is covered by 'if
(canUseMemoryMerge())` check in `SortImpl.java:399`. The affected code path
applies only to cases where merge between spilled and in-memory batches is
necessary. Note that this is a short term fix to improve managed sort
performance, in a long run, it is necessary to have an ability to merge all
batches in memory (using SV4) without spilling and be able to merge it with the
spilled data.
---