This is an automated email from the ASF dual-hosted git repository.
rbalamohan 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 5b81017 TEZ-4113: TezUtils::createByteStringFromConf should use
snappy instead of DeflaterOutputStream (rbalamohan, reviewed by Ashutosh
Chauhan)
5b81017 is described below
commit 5b81017a4d11c09cfa0180e3d56e22c22744559b
Author: Rajesh Balamohan <[email protected]>
AuthorDate: Wed Jan 22 03:55:46 2020 +0530
TEZ-4113: TezUtils::createByteStringFromConf should use snappy instead of
DeflaterOutputStream (rbalamohan, reviewed by Ashutosh Chauhan)
---
tez-api/src/main/java/org/apache/tez/common/TezUtils.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/tez-api/src/main/java/org/apache/tez/common/TezUtils.java
b/tez-api/src/main/java/org/apache/tez/common/TezUtils.java
index 072c02f..192d2a0 100644
--- a/tez-api/src/main/java/org/apache/tez/common/TezUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/common/TezUtils.java
@@ -25,9 +25,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.InflaterInputStream;
import com.google.common.base.Preconditions;
import com.google.protobuf.ByteString;
@@ -42,6 +39,8 @@ import org.apache.tez.dag.api.UserPayload;
import org.apache.tez.dag.api.records.DAGProtos;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
+import org.xerial.snappy.SnappyInputStream;
+import org.xerial.snappy.SnappyOutputStream;
/**
* Utility methods for setting up a DAG. Has helpers for setting up log4j
configuration, converting
@@ -77,8 +76,7 @@ public class TezUtils {
public static ByteString createByteStringFromConf(Configuration conf) throws
IOException {
Preconditions.checkNotNull(conf, "Configuration must be specified");
ByteString.Output os = ByteString.newOutput();
- DeflaterOutputStream compressOs = new DeflaterOutputStream(os,
- new Deflater(Deflater.BEST_SPEED));
+ SnappyOutputStream compressOs = new SnappyOutputStream(os);
try {
writeConfInPB(compressOs, conf);
} finally {
@@ -111,9 +109,7 @@ public class TezUtils {
*/
public static Configuration createConfFromByteString(ByteString byteString)
throws IOException {
Preconditions.checkNotNull(byteString, "ByteString must be specified");
- // SnappyInputStream uncompressIs = new
- // SnappyInputStream(byteString.newInput());
- try(InflaterInputStream uncompressIs = new
InflaterInputStream(byteString.newInput())) {
+ try(SnappyInputStream uncompressIs = new
SnappyInputStream(byteString.newInput());) {
DAGProtos.ConfigurationProto confProto =
DAGProtos.ConfigurationProto.parseFrom(uncompressIs);
Configuration conf = new Configuration(false);
readConfFromPB(confProto, conf);