zhengruifeng opened a new pull request #29185: URL: https://github.com/apache/spark/pull/29185
### What changes were proposed in this pull request? avoid unnecessary shuffle if possible ### Why are the changes needed? In `combineByKeyWithClassTag`, there is a check to avoid unnecessary shuffle if possible: ```scala if (self.partitioner == Some(partitioner)) { self.mapPartitions(iter => { val context = TaskContext.get() new InterruptibleIterator(context, aggregator.combineValuesByKey(iter, context)) }, preservesPartitioning = true) } else { new ShuffledRDD[K, V, C](self, partitioner) .setSerializer(serializer) .setAggregator(aggregator) .setMapSideCombine(mapSideCombine) } ``` `repartitionAndSortWithinPartitions` should also avoid unnecessary shuffle. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? added testsuites and existing testsuites ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org