mridulm commented on a change in pull request #34725:
URL: https://github.com/apache/spark/pull/34725#discussion_r767185148
##########
File path:
core/src/main/java/org/apache/spark/shuffle/sort/BypassMergeSortShuffleWriter.java
##########
@@ -165,10 +167,13 @@ public void write(Iterator<Product2<K, V>> records)
throws IOException {
// included in the shuffle write time.
writeMetrics.incWriteTime(System.nanoTime() - openStartTime);
+ Set<Integer> nonEmptyPartitionSet = new HashSet<>();
while (records.hasNext()) {
final Product2<K, V> record = records.next();
final K key = record._1();
- partitionWriters[partitioner.getPartition(key)].write(key,
record._2());
+ int partitionId = partitioner.getPartition(key);
+ partitionWriters[partitionId].write(key, record._2());
+ nonEmptyPartitionSet.add(partitionId);
Review comment:
This is updating the Set for every tuple processed.
Instead, why not use `partitionWriterSegments[i].length > 0` instead in
`writePartitionedData` ?
--
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]