Skip to content

Commit 8b3e37a

Browse files
committed
Return copy-backed Binary from Int96Generator.nextValue
Pre-PR, Int96Generator.nextBinaryValue went through FixedBinaryTestUtils.getFixedBinary which returned a constant-backed Binary. The refactor switched to Binary.fromReusedByteArray over the shared scratch buffer, so successive nextValue() calls mutate Binaries returned by earlier calls -- breaking any caller that retains results (e.g. RandomValues.wrapSorted).
1 parent 61bc607 commit 8b3e37a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.nio.ByteBuffer;
2424
import java.nio.ByteOrder;
2525
import java.util.ArrayList;
26+
import java.util.Arrays;
2627
import java.util.Comparator;
2728
import java.util.Iterator;
2829
import java.util.List;
@@ -236,7 +237,7 @@ public Binary nextValue() {
236237
.putLong(timeOfDay)
237238
.putInt(julianDay);
238239

239-
return Binary.fromReusedByteArray(buffer, 0, INT_96_LENGTH);
240+
return Binary.fromConstantByteArray(Arrays.copyOf(buffer, INT_96_LENGTH));
240241
}
241242

242243
@Override

0 commit comments

Comments
 (0)