Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16989#discussion_r115219343
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/MapStatusSuite.scala ---
    @@ -128,4 +130,22 @@ 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])
    +    objectOutputStream.writeObject(status1)
    +    objectOutputStream.flush()
    +    val array = arrayStream.toByteArray
    +    val objectInput = new ObjectInputStream(new 
ByteArrayInputStream(array))
    +    val status2 = 
objectInput.readObject().asInstanceOf[HighlyCompressedMapStatus]
    +    val avg = sizes.sum / 2001
    +    ((2 * avg + 1) to 2000).foreach {
    --- End diff --
    
    add some comments to explain that the index of the `sizes` array is the 
value of that element.


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