wsry commented on a change in pull request #10375: [FLINK-14845][runtime] 
Introduce data compression to reduce disk and network IO of shuffle.
URL: https://github.com/apache/flink/pull/10375#discussion_r354151248
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/NettyMessageSerializationTest.java
 ##########
 @@ -174,6 +197,18 @@ private void testEncodeDecodeBuffer(boolean 
testReadOnlyBuffer) {
                assertEquals(expected.backlog, actual.backlog);
        }
 
+       private Buffer compress(Buffer buffer) {
+               return COMPRESSOR.compressInPlace(buffer);
+       }
+
+       private ByteBuf decompress(ByteBuf buffer) {
+               MemorySegment segment = 
MemorySegmentFactory.allocateUnpooledSegment(BUFFER_SIZE);
+               Buffer compressedBuffer = new NetworkBuffer(segment, 
FreeingBufferRecycler.INSTANCE);
+               buffer.readBytes(compressedBuffer.asByteBuf(), 
buffer.readableBytes());
+               compressedBuffer.setCompressed(true);
+               return 
DECOMPRESSOR.decompressInPlace(compressedBuffer).asByteBuf();
 
 Review comment:
   The input is netty's ByteBuf not a Buffer.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to