spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayousterhout <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-7884] Move block deserialization from B...
Date Wed, 10 Jun 2015 22:24:16 GMT
Github user kayousterhout commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6423#discussion_r32173361
  
    --- Diff: core/src/main/scala/org/apache/spark/shuffle/hash/HashShuffleReader.scala ---
    @@ -33,17 +34,52 @@ private[spark] class HashShuffleReader[K, C](
         "Hash shuffle currently only supports fetching one partition")
     
       private val dep = handle.dependency
    +  private val blockManager = SparkEnv.get.blockManager
     
       /** Read the combined key-values for this reduce task */
       override def read(): Iterator[Product2[K, C]] = {
    +    val blockStreams = BlockStoreShuffleFetcher.fetchBlockStreams(
    +      handle.shuffleId, startPartition, context)
    +
    +    // Wrap the streams for compression based on configuration
    +    val wrappedStreams = blockStreams.map { case (blockId, inputStream) =>
    +      blockManager.wrapForCompression(blockId, inputStream)
    +    }
    +
         val ser = Serializer.getSerializer(dep.serializer)
    -    val iter = BlockStoreShuffleFetcher.fetch(handle.shuffleId, startPartition, context,
ser)
    +    val serializerInstance = ser.newInstance()
    +
    +    // Create a key/value iterator for each stream
    +    val recordIterator = wrappedStreams.flatMap { wrappedStream =>
    +      serializerInstance.deserializeStream(wrappedStream).asKeyValueIterator
    +    }
    +
    +    val readMetrics = context.taskMetrics.createShuffleReadMetricsForDependency()
    +    // Update read metrics for each record materialized
    +    val metricIter = new InterruptibleIterator[(Any, Any)](context, recordIterator) {
    +      override def next(): (Any, Any) = {
    +        readMetrics.incRecordsRead(1)
    +        delegate.next()
    +      }
    +    }
    +
    +    val iter = CompletionIterator[(Any, Any), Iterator[(Any, Any)]](metricIter, {
    --- End diff --
    
    This is a super-nit but if you change the above thing anyway, would you mind naming these
iterators in a consistent way (so either all "iter" or all "iterator")?


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