Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/src/main/scala/org/apache/spark/scheduler/MapStatus.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import java.io.{Externalizable, ObjectInput, ObjectOutput}
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

import com.esotericsoftware.kryo.{Kryo, KryoSerializable}
import com.esotericsoftware.kryo.io.{Input, Output}
import org.roaringbitmap.RoaringBitmap

import org.apache.spark.SparkEnv
Expand Down Expand Up @@ -142,7 +144,7 @@ private[spark] class HighlyCompressedMapStatus private (
private[this] var emptyBlocks: RoaringBitmap,
private[this] var avgSize: Long,
private var hugeBlockSizes: Map[Int, Byte])
extends MapStatus with Externalizable {
extends MapStatus with Externalizable with KryoSerializable {

// loc could be null when the default constructor is called during deserialization
require(loc == null || avgSize > 0 || hugeBlockSizes.size > 0 || numNonEmptyBlocks == 0,
Expand Down Expand Up @@ -189,6 +191,15 @@ private[spark] class HighlyCompressedMapStatus private (
}
hugeBlockSizes = hugeBlockSizesArray.toMap
}

override def write(kryo: Kryo, output: Output): Unit = {
kryo.writeClassAndObject(output, hugeBlockSizes)
}

override def read(kryo: Kryo, input: Input): Unit = {
hugeBlockSizes = kryo.readClassAndObject(input).asInstanceOf[Map[Int, Byte]]
}

}

private[spark] object HighlyCompressedMapStatus {
Expand Down