attilapiros commented on a change in pull request #25299: [SPARK-27651][Core]
Avoid the network when shuffle blocks are fetched from the same host
URL: https://github.com/apache/spark/pull/25299#discussion_r317614594
##########
File path: core/src/main/scala/org/apache/spark/storage/BlockManager.scala
##########
@@ -995,6 +1003,19 @@ private[spark] class BlockManager(
None
}
+ private[spark] def getHostLocalDirs(executorIds: Array[String])
+ : scala.collection.Map[String, Array[String]] = {
Review comment:
The predef `Map` is the immutable one. With just using `Map` as return type
I would got:
```
Error:(1012, 19) type mismatch;
found : Map[String,Array[String]] (in scala.collection)
required: Map[String,Array[String]] (in scala.collection.immutable)
cachedItems ++ notCachedItems
````
So I decided to avoid unnecessary conversion (copy of items) I would use
the the `Map` trait. See `toMap` implementation:
```
def toMap[T, U](implicit ev: A <:< (T, U)): immutable.Map[T, U] = {
val b = immutable.Map.newBuilder[T, U]
for (x <- self)
b += x
b.result()
}
```
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]