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

gabor 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 358a60d  PARQUET-1963: DeprecatedParquetInputFormat in 
CombineFileInputFormat throw NPE when the first sub-split is empty (#854)
358a60d is described below

commit 358a60d17ffd49b718633d505fdb6b77ce64f7a0
Author: daijyc <[email protected]>
AuthorDate: Wed Jan 20 08:02:15 2021 -0800

    PARQUET-1963: DeprecatedParquetInputFormat in CombineFileInputFormat throw 
NPE when the first sub-split is empty (#854)
---
 .../parquet/hadoop/mapred/DeprecatedParquetInputFormat.java    |  2 +-
 .../org/apache/parquet/hadoop/DeprecatedInputFormatTest.java   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/mapred/DeprecatedParquetInputFormat.java
 
b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/mapred/DeprecatedParquetInputFormat.java
index 3afdc7e..17c9895 100644
--- 
a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/mapred/DeprecatedParquetInputFormat.java
+++ 
b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/mapred/DeprecatedParquetInputFormat.java
@@ -100,9 +100,9 @@ public class DeprecatedParquetInputFormat<V> extends 
org.apache.hadoop.mapred.Fi
         }
 
         // read once to gain access to key and value objects
+        valueContainer = new Container<V>();
         if (realReader.nextKeyValue()) {
           firstRecord = true;
-          valueContainer = new Container<V>();
           valueContainer.set(realReader.getCurrentValue());
 
         } else {
diff --git 
a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/DeprecatedInputFormatTest.java
 
b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/DeprecatedInputFormatTest.java
index 58f395e..6909354 100644
--- 
a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/DeprecatedInputFormatTest.java
+++ 
b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/DeprecatedInputFormatTest.java
@@ -213,7 +213,9 @@ public class DeprecatedInputFormatTest {
     File outputFile = File.createTempFile("temp", null);
     outputFile.delete();
     PrintWriter pw = new PrintWriter(new FileWriter(inputFile));
-    pw.println(content);
+    if (content != null) {
+      pw.println(content);
+    }
     pw.close();
     writeJob = new Job(conf, "write");
 
@@ -239,10 +241,12 @@ public class DeprecatedInputFormatTest {
     File inputDir = File.createTempFile("temp", null);
     inputDir.delete();
     inputDir.mkdirs();
-    File parquetFile1 = createParquetFile("hello");
-    File parquetFile2 = createParquetFile("world");
+    File parquetFile1 = createParquetFile(null);
+    File parquetFile2 = createParquetFile("hello");
+    File parquetFile3 = createParquetFile("world");
     Files.move(parquetFile1.toPath(), new File(inputDir, "1").toPath());
     Files.move(parquetFile2.toPath(), new File(inputDir, "2").toPath());
+    Files.move(parquetFile3.toPath(), new File(inputDir, "3").toPath());
 
     File outputDir = File.createTempFile("temp", null);
     outputDir.delete();

Reply via email to