This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-java.git


The following commit(s) were added to refs/heads/master by this push:
     new efe71c218 GH-3404: fix CI 
TestByteBitPacking512VectorLE.unpackValuesUsingVector randomly oom (#3405)
efe71c218 is described below

commit efe71c218c9f6ba567f97c7476e7037a53b76333
Author: Zehua Zou <[email protected]>
AuthorDate: Fri Feb 27 17:35:25 2026 +0800

    GH-3404: fix CI TestByteBitPacking512VectorLE.unpackValuesUsingVector 
randomly oom (#3405)
---
 .../bitpacking/TestByteBitPacking512VectorLE.java  | 62 +++++++++++-----------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git 
a/parquet-plugins/parquet-encoding-vector/src/test/java/org/apache/parquet/column/values/bitpacking/TestByteBitPacking512VectorLE.java
 
b/parquet-plugins/parquet-encoding-vector/src/test/java/org/apache/parquet/column/values/bitpacking/TestByteBitPacking512VectorLE.java
index 8664b8f81..3a510d269 100644
--- 
a/parquet-plugins/parquet-encoding-vector/src/test/java/org/apache/parquet/column/values/bitpacking/TestByteBitPacking512VectorLE.java
+++ 
b/parquet-plugins/parquet-encoding-vector/src/test/java/org/apache/parquet/column/values/bitpacking/TestByteBitPacking512VectorLE.java
@@ -22,8 +22,9 @@ import static org.junit.Assert.assertArrayEquals;
 
 import java.math.BigDecimal;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
 import org.junit.Assume;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -41,30 +42,31 @@ public class TestByteBitPacking512VectorLE {
   }
 
   private void unpackValuesUsingVectorBitWidth(int bitWidth) {
-    List<int[]> intInputs = getRangeData(bitWidth);
-
-    for (int[] intInput : intInputs) {
-      int pack8Count = intInput.length / 8;
-      int byteOutputSize = pack8Count * bitWidth;
-      byte[] byteOutput = new byte[byteOutputSize];
-      int[] output1 = new int[intInput.length];
-      int[] output2 = new int[intInput.length];
-      int[] output3 = new int[intInput.length];
-
-      BytePacker bytePacker = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
-      for (int i = 0; i < pack8Count; i++) {
-        bytePacker.pack8Values(intInput, 8 * i, byteOutput, bitWidth * i);
-      }
+    try (Stream<int[]> intInputs = getRangeData(bitWidth)) {
+      intInputs.forEach(intInput -> {
+        int pack8Count = intInput.length / 8;
+        int byteOutputSize = pack8Count * bitWidth;
+        byte[] byteOutput = new byte[byteOutputSize];
+        int[] output = new int[intInput.length];
+
+        BytePacker bytePacker = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
+        for (int i = 0; i < pack8Count; i++) {
+          bytePacker.pack8Values(intInput, 8 * i, byteOutput, bitWidth * i);
+        }
 
-      unpack8Values(bitWidth, byteOutput, output1);
-      unpackValuesUsingVectorArray(bitWidth, byteOutput, output2);
+        unpack8Values(bitWidth, byteOutput, output);
+        assertArrayEquals(intInput, output);
+        Arrays.fill(output, 0);
 
-      ByteBuffer byteBuffer = ByteBuffer.wrap(byteOutput);
-      unpackValuesUsingVectorByteBuffer(bitWidth, byteBuffer, output3);
+        unpackValuesUsingVectorArray(bitWidth, byteOutput, output);
+        assertArrayEquals(intInput, output);
+        Arrays.fill(output, 0);
 
-      assertArrayEquals(intInput, output1);
-      assertArrayEquals(intInput, output2);
-      assertArrayEquals(intInput, output3);
+        ByteBuffer byteBuffer = ByteBuffer.wrap(byteOutput);
+        unpackValuesUsingVectorByteBuffer(bitWidth, byteBuffer, output);
+        assertArrayEquals(intInput, output);
+        Arrays.fill(output, 0);
+      });
     }
   }
 
@@ -119,8 +121,7 @@ public class TestByteBitPacking512VectorLE {
     }
   }
 
-  private List<int[]> getRangeData(int bitWidth) {
-    List<int[]> result = new ArrayList<>();
+  private Stream<int[]> getRangeData(int bitWidth) {
     int itemMax = 268435456;
 
     long maxValue = getMaxValue(bitWidth);
@@ -131,9 +132,11 @@ public class TestByteBitPacking512VectorLE {
       ++itemCount;
     }
 
-    for (int i = 0; i < itemCount; i++) {
+    final int finalItemCount = itemCount;
+
+    return IntStream.range(0, finalItemCount).mapToObj(i -> {
       int len;
-      if ((i == itemCount - 1) && mode != 0) {
+      if ((i == finalItemCount - 1) && mode != 0) {
         len = mode;
       } else {
         len = itemMax;
@@ -162,9 +165,8 @@ public class TestByteBitPacking512VectorLE {
         array[j] = value;
         j++;
       }
-      result.add(array);
-    }
-    return result;
+      return array;
+    });
   }
 
   private long getMaxValue(int bitWidth) {

Reply via email to