You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "zjf2012 (via GitHub)" <gi...@apache.org> on 2023/02/03 01:57:00 UTC

[GitHub] [incubator-uniffle] zjf2012 commented on a diff in pull request #495: [ISSUE-476][FEATURE] Respect `spark.shuffle.compress` configuration in Uniffle

zjf2012 commented on code in PR #495:
URL: https://github.com/apache/incubator-uniffle/pull/495#discussion_r1095273816


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/reader/RssShuffleDataIterator.java:
##########
@@ -66,12 +67,15 @@ public RssShuffleDataIterator(
     this.serializerInstance = serializer.newInstance();
     this.shuffleReadClient = shuffleReadClient;
     this.shuffleReadMetrics = shuffleReadMetrics;
-    this.codec = Codec.newInstance(rssConf);
+    boolean compress = rssConf.getBoolean(RssSparkConfig.SPARK_SHUFFLE_COMPRESS.key()
+            .substring(RssSparkConfig.SPARK_RSS_CONFIG_PREFIX.length()),
+        RssSparkConfig.SPARK_SHUFFLE_COMPRESS.defaultValue().get());
+    this.codec = compress ? Codec.newInstance(rssConf) : null;
   }
 
   public Iterator<Tuple2<Object, Object>> createKVIterator(ByteBuffer data, int size) {
     clearDeserializationStream();
-    byteBufInputStream = new ByteBufInputStream(Unpooled.wrappedBuffer(data.array(), 0, size), true);
+    byteBufInputStream = new ByteBufInputStream(Unpooled.wrappedBuffer(data.array(), data.position(), size), true);

Review Comment:
   > does this mean the old code path have a bug here?
   
   I think there is no bug in old code since the caller always clear the ByteBuffer (data), which put start position at 0, before decompressing and calling "createKVIterator". 
   
   If there is no compress/decompress involved, the ByteBuffer (data) is a wrapper of existing array, which may not start at position 0.  I found this issue during UT.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org