You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by ab...@apache.org on 2021/04/10 08:11:58 UTC

[tez] branch master updated: TEZ-4302: NullPointerException in CodecUtils with GzipCodec (#117) (Xi Chen reviewed by Laszlo Bodor)

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

abstractdog pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/master by this push:
     new b934644  TEZ-4302: NullPointerException in CodecUtils with GzipCodec (#117) (Xi Chen reviewed by Laszlo Bodor)
b934644 is described below

commit b934644871027722b40d83822bf6a0978141d6bf
Author: jshmchenxi <js...@gmail.com>
AuthorDate: Sat Apr 10 16:11:48 2021 +0800

    TEZ-4302: NullPointerException in CodecUtils with GzipCodec (#117) (Xi Chen reviewed by Laszlo Bodor)
---
 .../java/org/apache/tez/runtime/library/common/TezRuntimeUtils.java  | 5 ++++-
 .../main/java/org/apache/tez/runtime/library/utils/CodecUtils.java   | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/TezRuntimeUtils.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/TezRuntimeUtils.java
index 9ff3d1c..a1df131 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/TezRuntimeUtils.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/TezRuntimeUtils.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.api.TaskContext;
@@ -269,7 +270,9 @@ public class TezRuntimeUtils {
   public static String getBufferSizeProperty(String className) {
     switch (className) {
     case "org.apache.hadoop.io.compress.DefaultCodec":
-      return "io.file.buffer.size";
+    case "org.apache.hadoop.io.compress.BZip2Codec":
+    case "org.apache.hadoop.io.compress.GzipCodec":
+      return CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
     case "org.apache.hadoop.io.compress.SnappyCodec":
       return CommonConfigurationKeys.IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY;
     case "org.apache.hadoop.io.compress.ZStandardCodec":
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/utils/CodecUtils.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/utils/CodecUtils.java
index 99d22c5..8e5154f 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/utils/CodecUtils.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/utils/CodecUtils.java
@@ -78,7 +78,8 @@ public final class CodecUtils {
       throws IOException {
     String bufferSizeProp = TezRuntimeUtils.getBufferSizeProperty(codec);
     Configurable configurableCodec = (Configurable) codec;
-    int originalSize = configurableCodec.getConf().getInt(bufferSizeProp, DEFAULT_BUFFER_SIZE);
+    int originalSize = bufferSizeProp == null ? DEFAULT_BUFFER_SIZE :
+            configurableCodec.getConf().getInt(bufferSizeProp, DEFAULT_BUFFER_SIZE);
 
     CompressionInputStream in = null;