spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shivaram <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-8137][core] Improve treeAggregate to co...
Date Wed, 02 Sep 2015 03:55:49 GMT
Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7461#discussion_r38497048
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -1080,6 +1080,21 @@ abstract class RDD[T: ClassTag](
           var partiallyAggregated = mapPartitions(it => Iterator(aggregatePartition(it)))
           var numPartitions = partiallyAggregated.partitions.length
           val scale = math.max(math.ceil(math.pow(numPartitions, 1.0 / depth)).toInt, 2)
    +
    +      // Do one level of aggregation based on executorId before starting the tree
    +      // NOTE: exclude the driver from list of executors
    +      val numExecutors = math.max(context.getExecutorStorageStatus.length - 1, 1)
    +      partiallyAggregated = partiallyAggregated.mapPartitionsWithIndex { case (idx, iter)
=>
    +        def isAllDigits(x: String) = x forall Character.isDigit
    +        val execId = SparkEnv.get.executorId
    +        if (isAllDigits(execId)) {
    +          iter.map((execId.toInt, _))
    +        } else {
    +          iter.map((execId.hashCode, _))
    --- End diff --
    
    Hmm it looks like the reason I added this in an earlier version was to avoid some hashCollisions[1].
Not sure what was exactly the problem as I can't reproduce any collisions with all digit strings
-- so going with `hashCode` for now seems fine.
    
    [1] https://github.com/amplab/ml-matrix/commit/5d7e00e136f8bbc2233adca6d495507d446815bf


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message