Skip to content

Commit 767d3ca

Browse files
committed
Fix invalid range in UnsafeSorter.
TODO: write fuzz tests to uncover stuff like this. Sorting has nice invariants; should be an easy test to write.
1 parent e900152 commit 767d3ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/apache/spark/unsafe/sort/UnsafeSorter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void insertRecord(long objectAddress) {
120120
}
121121

122122
public Iterator<KeyPointerAndPrefix> getSortedIterator() {
123-
sorter.sort(sortBuffer, 0, sortBufferInsertPosition, sortComparator);
123+
sorter.sort(sortBuffer, 0, sortBufferInsertPosition / 2, sortComparator);
124124
return new Iterator<KeyPointerAndPrefix>() {
125125
private int position = 0;
126126
private final KeyPointerAndPrefix keyPointerAndPrefix = new KeyPointerAndPrefix();

0 commit comments

Comments
 (0)