parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ziva...@apache.org
Subject [parquet-mr] branch master updated: Revert "PARQUET-1353: Fix random data generator. (#504)"
Date Tue, 25 Sep 2018 12:39:01 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 0569f51  Revert "PARQUET-1353: Fix random data generator. (#504)"
0569f51 is described below

commit 0569f5128d5e529b5114ba05db9b853625918b43
Author: Zoltan Ivanfi <zi@cloudera.com>
AuthorDate: Tue Sep 25 14:38:00 2018 +0200

    Revert "PARQUET-1353: Fix random data generator. (#504)"
    
    This reverts commit 1f79f9bd0ba61b8ec0bae1dec71ef7249d41eacd because of
    concerns raised in the code review after the pull request was merged.
---
 .../src/test/java/org/apache/parquet/statistics/RandomValues.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java
b/parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java
index a3f41e9..16db5cb 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java
@@ -84,18 +84,19 @@ public class RandomValues {
 
   static abstract class RandomBinaryBase<T extends Comparable<T>> extends RandomValueGenerator<T>
{
     protected final int bufferLength;
+    protected final byte[] buffer;
 
     public RandomBinaryBase(long seed, int bufferLength) {
       super(seed);
 
       this.bufferLength = bufferLength;
+      this.buffer = new byte[bufferLength];
     }
 
     public abstract Binary nextBinaryValue();
 
     public Binary asReusedBinary(byte[] data) {
       int length = Math.min(data.length, bufferLength);
-      byte[] buffer = new byte[length];
       System.arraycopy(data, 0, buffer, 0, length);
       return Binary.fromReusedByteArray(data, 0, length);
     }
@@ -286,8 +287,7 @@ public class RandomValues {
     @Override
     public Binary nextValue() {
       // use a random length, but ensure it is at least a few bytes
-      int length = 5 + randomPositiveInt(bufferLength - 5);
-      byte[] buffer = new byte[length];
+      int length = 5 + randomPositiveInt(buffer.length - 5);
       for (int index = 0; index < length; index++) {
         buffer[index] = (byte) randomInt();
       }
@@ -308,7 +308,6 @@ public class RandomValues {
 
     @Override
     public Binary nextValue() {
-      byte[] buffer = new byte[bufferLength];
       for (int index = 0; index < buffer.length; index++) {
         buffer[index] = (byte) randomInt();
       }


Mime
View raw message