Drill places an upper limit on the number of rows in a batch of 64K. That is 65,536 decimal. When we index records, the indexes run from 0 to 64K-1 or 0 to 65,535.
The sort code incorrectly uses Character.MAX_VALUE as the maximum row count. So, if an incoming batch uses the full 64K size, sort ends up splitting batches unnecessarily.
The fix is to instead use the correct constant `ValueVector.MAX_ROW_COUNT`.