spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rxin <...@git.apache.org>
Subject [GitHub] spark pull request: SPARK-2787: Make sort-based shuffle write file...
Date Wed, 06 Aug 2014 19:38:08 GMT
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1799#discussion_r15898020
  
    --- Diff: core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala ---
    @@ -54,87 +55,36 @@ private[spark] class SortShuffleWriter[K, V, C](
     
       /** Write a bunch of records to this task's output */
       override def write(records: Iterator[_ <: Product2[K, V]]): Unit = {
    -    // Get an iterator with the elements for each partition ID
    -    val partitions: Iterator[(Int, Iterator[Product2[K, _]])] = {
    -      if (dep.mapSideCombine) {
    -        if (!dep.aggregator.isDefined) {
    -          throw new IllegalStateException("Aggregator is empty for map-side combine")
    -        }
    -        sorter = new ExternalSorter[K, V, C](
    -          dep.aggregator, Some(dep.partitioner), dep.keyOrdering, dep.serializer)
    -        sorter.write(records)
    -        sorter.partitionedIterator
    -      } else {
    -        // In this case we pass neither an aggregator nor an ordering to the sorter,
because we
    -        // don't care whether the keys get sorted in each partition; that will be done
on the
    -        // reduce side if the operation being run is sortByKey.
    -        sorter = new ExternalSorter[K, V, V](
    -          None, Some(dep.partitioner), None, dep.serializer)
    -        sorter.write(records)
    -        sorter.partitionedIterator
    +    if (dep.mapSideCombine) {
    +      if (!dep.aggregator.isDefined) {
    +        throw new IllegalStateException("Aggregator is empty for map-side combine")
           }
    +      sorter = new ExternalSorter[K, V, C](
    +        dep.aggregator, Some(dep.partitioner), dep.keyOrdering, dep.serializer)
    +      sorter.insertAll(records)
    +    } else {
    +      // In this case we pass neither an aggregator nor an ordering to the sorter, because
we
    +      // don't care whether the keys get sorted in each partition; that will be done
on the
    +      // reduce side if the operation being run is sortByKey.
    +      sorter = new ExternalSorter[K, V, V](
    --- End diff --
    
    I think this fits in one line without wrapping ...


---
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