Skip to content

Commit 350ebca

Browse files
comments
1 parent cfb241a commit 350ebca

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/ShuffleSpecSuite.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import org.apache.spark.sql.catalyst.plans.physical._
2525
import org.apache.spark.sql.internal.SQLConf
2626

2727
class 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(

sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ case class EnsureRequirements(
165165
// Check if the following conditions are satisfied:
166166
// 1. There are exactly two children (e.g., join). Note that Spark doesn't support
167167
// multi-way join at the moment, so this check should be sufficient.
168-
// 2. All children are of the compatible key group partitioning or
168+
// 2. All children are of the compatible key group partitioning or
169169
// compatible shuffle partition id pass through partitioning
170170
// If both are true, skip shuffle.
171171
val areChildrenCompatible = parent.isDefined &&

sql/core/src/test/scala/org/apache/spark/sql/execution/exchange/EnsureRequirementsSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ class EnsureRequirementsSuite extends SharedSparkSession {
12171217
) =>
12181218
assert(leftKeys === Seq(exprA))
12191219
assert(rightKeys === Seq(exprA))
1220-
case other => fail(s"We don't expect shuffle on neither sides, but got: $other")
1220+
case other => fail(s"We don't expect shuffle on either side, but got: $other")
12211221
}
12221222
}
12231223
}
@@ -1328,7 +1328,7 @@ class EnsureRequirementsSuite extends SharedSparkSession {
13281328
) =>
13291329
assert(leftKeys === Seq(exprA, exprB))
13301330
assert(rightKeys === Seq(exprA, exprB))
1331-
case other => fail(s"We don't expect shuffle on neither sides with multiple " +
1331+
case other => fail(s"We don't expect shuffle on either side with multiple " +
13321332
s"clustering keys, but got: $other")
13331333
}
13341334

0 commit comments

Comments
 (0)