wForget commented on code in PR #2808:
URL: https://github.com/apache/uniffle/pull/2808#discussion_r4236099657
##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleReadClientImpl.java:
##########
@@ -374,15 +383,33 @@ private int read() {
if (sdr == null) {
return 0;
}
- if (decompressionWorker != null) {
- decompressionWorker.add(batchIndex++, shuffleDataResult);
- segmentIndex = 0;
- }
readBuffer = sdr.getDataBuffer();
if (readBuffer == null || readBuffer.capacity() == 0) {
return 0;
}
- bufferSegmentQueue.addAll(sdr.getBufferSegments());
+ // filter out illegal or any invalid segments
+ Set<Long> seenBlockIds = Sets.newHashSet();
+ List<BufferSegment> segments = Lists.newArrayList();
+ long pendingBlockCount = pendingBlockIds.getLongCardinality();
+ for (BufferSegment segment : sdr.getBufferSegments()) {
+ if (!isValidSegment(segment) || !seenBlockIds.add(segment.getBlockId()))
{
+ recordSkippedSegment(segment);
+ } else {
+ segments.add(segment);
+ // The consumer stops after the last required block, so do not account
for trailing
+ // segments.
+ if (segments.size() == pendingBlockCount) {
+ break;
+ }
+ }
+ }
+ // push the valid segments into the overlapping decompression queue
+ if (decompressionWorker != null) {
+ decompressionWorker.add(
Review Comment:
nit: Perhaps we can directly modify the parameters of
DecompressionWorker#add instead of creating a new ShuffleDataResult object.
--
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]