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

    https://github.com/apache/spark/pull/9214#discussion_r43078906
  
    --- Diff: core/src/test/scala/org/apache/spark/ShuffleSuite.scala ---
    @@ -88,33 +92,16 @@ abstract class ShuffleSuite extends SparkFunSuite with 
Matchers with LocalSparkC
       }
     
       test("zero sized blocks") {
    -    // Use a local cluster with 2 processes to make sure there are both 
local and remote blocks
    -    sc = new SparkContext("local-cluster[2,1,1024]", "test", conf)
    -
    -    // 201 partitions (greater than 
"spark.shuffle.sort.bypassMergeThreshold") from 4 keys
    -    val NUM_BLOCKS = 201
    -    val a = sc.parallelize(1 to 4, NUM_BLOCKS)
    -    val b = a.map(x => (x, x*2))
    -
         // NOTE: The default Java serializer doesn't create zero-sized blocks.
         //       So, use Kryo
    -    val c = new ShuffledRDD[Int, Int, Int](b, new 
HashPartitioner(NUM_BLOCKS))
    -      .setSerializer(new KryoSerializer(conf))
    -
    -    val shuffleId = c.dependencies.head.asInstanceOf[ShuffleDependency[_, 
_, _]].shuffleId
    -    assert(c.count === 4)
    -
    -    val blockSizes = (0 until NUM_BLOCKS).flatMap { id =>
    -      val statuses = 
SparkEnv.get.mapOutputTracker.getMapSizesByExecutorId(shuffleId, id)
    -      statuses.flatMap(_._2.map(_._2))
    -    }
    -    val nonEmptyBlocks = blockSizes.filter(x => x > 0)
    -
    -    // We should have at most 4 non-zero sized partitions
    -    assert(nonEmptyBlocks.size <= 4)
    +    testZeroSizedBlocks(Some(new KryoSerializer(conf)))
       }
     
       test("zero sized blocks without kryo") {
    +    testZeroSizedBlocks(None)
    +  }
    +
    +  def testZeroSizedBlocks(serOpt: Option[Serializer]): Unit = {
    --- End diff --
    
    unrelated to this change, but "zero sized blocks" and "zero sized blocks 
without kryo" were almost identical so I made a helper,


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