@@ -25,6 +25,9 @@ import org.apache.spark.sql.catalyst.plans.physical._
2525import org .apache .spark .sql .internal .SQLConf
2626
2727class ShuffleSpecSuite extends SparkFunSuite with SQLHelper {
28+ private val passThrough_a_10 = ShufflePartitionIdPassThrough (DirectShufflePartitionID ($" a" ), 10 )
29+ private val passThrough_b_10 = ShufflePartitionIdPassThrough (DirectShufflePartitionID ($" b" ), 10 )
30+ private val passThrough_c_10 = ShufflePartitionIdPassThrough (DirectShufflePartitionID ($" c" ), 10 )
2831 protected def checkCompatible (
2932 left : ShuffleSpec ,
3033 right : ShuffleSpec ,
@@ -484,12 +487,11 @@ class ShuffleSpecSuite extends SparkFunSuite with SQLHelper {
484487 test(" compatibility: ShufflePartitionIdPassThroughSpec on both sides" ) {
485488 val ab = ClusteredDistribution (Seq ($" a" , $" b" ))
486489 val cd = ClusteredDistribution (Seq ($" c" , $" d" ))
487- val passThrough_a_10 = ShufflePartitionIdPassThrough (DirectShufflePartitionID ($" a" ), 10 )
488490
489491 // Identical specs should be compatible
490492 checkCompatible(
491493 passThrough_a_10.createShuffleSpec(ab),
492- ShufflePartitionIdPassThrough ( DirectShufflePartitionID ($ " c " ), 10 ) .createShuffleSpec(cd),
494+ passThrough_c_10 .createShuffleSpec(cd),
493495 expected = true
494496 )
495497
@@ -502,23 +504,22 @@ class ShuffleSpecSuite extends SparkFunSuite with SQLHelper {
502504
503505 // Mismatched key positions should be incompatible
504506 checkCompatible(
505- ShufflePartitionIdPassThrough ( DirectShufflePartitionID ($ " b " ), 10 ) .createShuffleSpec(ab),
506- ShufflePartitionIdPassThrough ( DirectShufflePartitionID ($ " c " ), 10 ) .createShuffleSpec(cd),
507+ passThrough_b_10 .createShuffleSpec(ab),
508+ passThrough_c_10 .createShuffleSpec(cd),
507509 expected = false
508510 )
509511
510512 // Mismatched clustering keys
511513 checkCompatible(
512514 passThrough_a_10.createShuffleSpec(ClusteredDistribution (Seq ($" e" , $" b" ))),
513- ShufflePartitionIdPassThrough ( DirectShufflePartitionID ($ " c " ), 10 ) .createShuffleSpec(ab),
515+ passThrough_c_10 .createShuffleSpec(ab),
514516 expected = false
515517 )
516518 }
517519
518520 test(" compatibility: ShufflePartitionIdPassThroughSpec vs other specs" ) {
519521 val ab = ClusteredDistribution (Seq ($" a" , $" b" ))
520522 val cd = ClusteredDistribution (Seq ($" c" , $" d" ))
521- val passThrough_a_10 = ShufflePartitionIdPassThrough (DirectShufflePartitionID ($" a" ), 10 )
522523
523524 // Compatibility with SinglePartitionShuffleSpec when numPartitions is 1
524525 checkCompatible(
0 commit comments