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_r408747576
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpillingAdaptiveSpanningRecordDeserializer.java
##########
@@ -580,11 +582,11 @@ private void addNextChunkFromMemorySegment(MemorySegment
segment, int offset, in
}
@Nullable
- MemorySegment copyToTargetSegment() {
+ MemorySegment copyToTargetSegment() throws IOException {
// for the case of only partial length, no data
final int position = lengthBuffer.position();
if (position > 0) {
- MemorySegment segment =
MemorySegmentFactory.allocateUnpooledSegment(lengthBuffer.remaining());
+ MemorySegment segment =
MemorySegmentFactory.allocateUnpooledSegment(position);
Review comment:
Still broken (see added test).
Fix should be:
```
MemorySegment segment =
MemorySegmentFactory.allocateUnpooledSegment(position);
lengthBuffer.position(0);
segment.put(0, lengthBuffer, position);
return segment;
```
----------------------------------------------------------------
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