ulysses-you commented on a change in pull request #35719:
URL: https://github.com/apache/spark/pull/35719#discussion_r819369080
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/ShuffledRowRDD.scala
##########
@@ -177,19 +177,36 @@ class ShuffledRowRDD(
val tracker =
SparkEnv.get.mapOutputTracker.asInstanceOf[MapOutputTrackerMaster]
partition.asInstanceOf[ShuffledRowRDDPartition].spec match {
case CoalescedPartitionSpec(startReducerIndex, endReducerIndex, _) =>
- // TODO order by partition size.
- startReducerIndex.until(endReducerIndex).flatMap { reducerIndex =>
- tracker.getPreferredLocationsForShuffle(dependency, reducerIndex)
- }
+ tracker.getPreferredLocationsForShuffle(
+ dependency,
+ 0,
+ dependency.rdd.getNumPartitions,
+ startReducerIndex,
+ endReducerIndex)
- case PartialReducerPartitionSpec(_, startMapIndex, endMapIndex, _) =>
- tracker.getMapLocation(dependency, startMapIndex, endMapIndex)
+ case PartialReducerPartitionSpec(reducerIndex, startMapIndex,
endMapIndex, _) =>
+ tracker.getPreferredLocationsForShuffle(
Review comment:
I agree. Now we have two cases of local shuffle reader:
- `PartialMapperPartitionSpec`, if the partition < 1000, it has no affect
since it only has one map and always return a location.
- `CoalescedMapperPartitionSpec `, it is a trade-off between small partition
and data locality that takes some maps into on reducer. So I think it should
follow this behavior.
Given this, seems we can relax the condition for the special case:
```scala
if (startMapIndex + 1 = endMapIndex)
return that map location.
else
...
```
what do you think ? @Ngone51
--
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]