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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to