Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9559#discussion_r44357664
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/MapStatus.scala ---
    @@ -121,6 +123,65 @@ private[spark] class CompressedMapStatus(
     
     /**
      * A [[MapStatus]] implementation that only stores the average size of 
non-empty blocks,
    + * plus a hashset for tracking which blocks are empty(dense) / 
non-empty(sparse).
    + * using a HashSet[Int] can save more memory usage than BitSet
    + *
    + * @param loc location where the task is being executed
    + * @param numNonEmptyBlocks the number of non-empty blocks
    + * @param markedBlocks a HashSet tracking which blocks are empty(dense) / 
non-empty(sparse)
    + * @param avgSize average size of the non-empty blocks
    + */
    +private[spark] class MapStatusTrackingEmptyBlocks private (
    +    private[this] var loc: BlockManagerId,
    +    private[this] var numNonEmptyBlocks: Int,
    +    private[this] var markedBlocks: mutable.HashSet[Int],
    +    private[this] var avgSize: Long,
    +    private[this] var isSparse: Boolean)
    +  extends MapStatus with Externalizable {
    +
    +  // loc could be null when the default constructor is called during 
deserialization
    +  require(loc == null || avgSize > 0 || numNonEmptyBlocks == 0,
    +    "Average size can only be zero for map stages that produced no output")
    +
    +  protected def this() = this(null, -1, null, -1, false)  // For 
deserialization only
    +
    +  override def location: BlockManagerId = loc
    +
    +  override def getSizeForBlock(reduceId: Int): Long = {
    +    if (isSparse ^ markedBlocks.contains(reduceId)) {
    +      0
    +    } else {
    +      avgSize
    +    }
    +  }
    +
    +  override def writeExternal(out: ObjectOutput): Unit = 
Utils.tryOrIOException {
    +    loc.writeExternal(out)
    +    out.writeObject(markedBlocks)
    +    out.writeLong(avgSize)
    +  }
    +
    +  override def readExternal(in: ObjectInput): Unit = 
Utils.tryOrIOException {
    +    loc = BlockManagerId(in)
    +    markedBlocks = new mutable.HashSet[Int]
    +    markedBlocks = in.readObject().asInstanceOf[mutable.HashSet[Int]]
    --- End diff --
    
    did you mean to immediately override the assignment on the previous line?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to