Skip to content

Commit

Permalink
DRILL-5344: External sort priority queue copier fails with an empty b…
Browse files Browse the repository at this point in the history
…atch

Unit tests showed that the “priority queue copier” does not handle an
empty batch. This has not been an issue because code elsewhere in the
sort specifically works around this issue. This fix resolves the issue
at the source to avoid the need for future work-arounds.

closes #778
  • Loading branch information
Paul Rogers authored and arina-ielchiieva committed May 5, 2017
1 parent 35bccd0 commit f1baec3
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -57,9 +57,12 @@ public void setup(FragmentContext context, BufferAllocator allocator, VectorAcce

queueSize = 0;
for (int i = 0; i < size; i++) {
vector4.set(i, i, batchGroups.get(i).getNextIndex());
siftUp();
queueSize++;
int index = batchGroups.get(i).getNextIndex();
vector4.set(i, i, index);
if (index > -1) {
siftUp();
queueSize++;
}
}
}

Expand Down

0 comments on commit f1baec3

Please sign in to comment.