AHeise commented on a change in pull request #11751: [FLINK-16587][network] 
Provide the method for getting unconsumed buffer from RecordDeserializer
URL: https://github.com/apache/flink/pull/11751#discussion_r408776373
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializationTest.java
 ##########
 @@ -179,6 +185,77 @@ private static void testSerializationRoundTrip(
                Assert.assertFalse(deserializer.hasUnfinishedData());
        }
 
+       @Test
+       public void testSmallRecordUnconsumedBuffer() throws Exception {
+               RecordSerializer<SerializationTestType> serializer = new 
SpanningRecordSerializer<>();
+               RecordDeserializer<SerializationTestType> deserializer =
+                       new SpillingAdaptiveSpanningRecordDeserializer<>(
+                               new 
String[]{tempFolder.getRoot().getAbsolutePath()});
+
+               testUnconsumedBuffer(serializer, deserializer, 
Util.randomRecord(SerializationTestTypeFactory.INT), 1024);
+       }
+
+       /**
+        * Test both for spanning records and for handling the length buffer, 
that's why it's going byte by byte.
+        */
+       @Test
+       public void testSpanningRecordUnconsumedBuffer() throws Exception {
+               RecordSerializer<SerializationTestType> serializer = new 
SpanningRecordSerializer<>();
+               RecordDeserializer<SerializationTestType> deserializer =
+                       new SpillingAdaptiveSpanningRecordDeserializer<>(
+                               new 
String[]{tempFolder.getRoot().getAbsolutePath()});
+
+               testUnconsumedBuffer(serializer, deserializer, 
Util.randomRecord(SerializationTestTypeFactory.INT), 1);
+       }
+
 
 Review comment:
   Add test for records with >128 bytes length.
   
   ```
   
        @Test
        public void testLargeSpanningRecordUnconsumedBuffer() throws Exception {
                RecordSerializer<SerializationTestType> serializer = new 
SpanningRecordSerializer<>();
                RecordDeserializer<SerializationTestType> deserializer =
                        new SpillingAdaptiveSpanningRecordDeserializer<>(
                                new 
String[]{tempFolder.getRoot().getAbsolutePath()});
   
   
                testUnconsumedBuffer(serializer, deserializer, 
Util.randomRecord(SerializationTestTypeFactory.BYTE_ARRAY), 1);
        }
   ```

----------------------------------------------------------------
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