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

    https://github.com/apache/spark/pull/16989#discussion_r114965327
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/MapStatusSuite.scala ---
    @@ -128,4 +130,23 @@ class MapStatusSuite extends SparkFunSuite {
         assert(size1 === size2)
         assert(!success)
       }
    +
    +  test("Blocks which are bigger than 2 * average size should not be 
underestimated.") {
    +    val sizes = Array.concat(Array.fill[Long](1000)(1L), (1000L to 
2000L).toArray)
    +    val status1 = MapStatus(BlockManagerId("exec-0", "host-0", 100), sizes)
    +    val arrayStream = new ByteArrayOutputStream(102400)
    +    val objectOutputStream = new ObjectOutputStream(arrayStream)
    +    assert(status1.isInstanceOf[HighlyCompressedMapStatus])
    +    
status1.asInstanceOf[HighlyCompressedMapStatus].writeExternal(objectOutputStream)
    +    objectOutputStream.flush()
    +    val array = arrayStream.toByteArray
    +    val objectInput = new ObjectInputStream(new 
ByteArrayInputStream(array))
    +    val status2 = new HighlyCompressedMapStatus()
    +    status2.readExternal(objectInput)
    --- End diff --
    
    I'm a little bit confused and hesitant here.
    We `writeExternal` for serialization and do initialization in 
`readExternal` when deserialize, right?
    `objectInput.readObject().asInstanceOf[HighlyCompressedMapStatus]` is not 
ok, I think?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to