sanha commented on a change in pull request #205: [NEMO-366] 
DirectByteArrayOutputStream bug in SerializedPartition
URL: https://github.com/apache/incubator-nemo/pull/205#discussion_r268480918
 
 

 ##########
 File path: 
runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/DataUtil.java
 ##########
 @@ -119,8 +119,8 @@ private static void serializePartition(final 
EncoderFactory encoderFactory,
         // We need to close wrappedStream on here, because 
DirectByteArrayOutputStream:getBufDirectly() returns
         // inner buffer directly, which can be an unfinished(not flushed) 
buffer.
         wrappedStream.close();
-        final byte[] serializedBytes = bytesOutputStream.getBufDirectly();
-        final int actualLength = bytesOutputStream.getCount();
+        final byte[] serializedBytes = bytesOutputStream.toByteArray();
 
 Review comment:
   This will incur an array copy for the whole bytes.
   Isn't there any other options (or any refactoring plan)?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to