szehon-ho commented on code in PR #52443:
URL: https://github.com/apache/spark/pull/52443#discussion_r2449999408
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/ShuffleSpecSuite.scala:
##########
@@ -479,4 +480,65 @@ class ShuffleSpecSuite extends SparkFunSuite with
SQLHelper {
"methodName" -> "createPartitioning$",
"className" ->
"org.apache.spark.sql.catalyst.plans.physical.ShuffleSpec"))
}
+
+ test("compatibility: ShufflePartitionIdPassThroughSpec on both sides") {
+ val ab = ClusteredDistribution(Seq($"a", $"b"))
+ val cd = ClusteredDistribution(Seq($"c", $"d"))
+ val passThrough_a_10 =
ShufflePartitionIdPassThrough(DirectShufflePartitionID($"a"), 10)
+
+ // Identical specs should be compatible
+ checkCompatible(
+ passThrough_a_10.createShuffleSpec(ab),
+ ShufflePartitionIdPassThrough(DirectShufflePartitionID($"c"),
10).createShuffleSpec(cd),
+ expected = true
+ )
+
+ // Different number of partitions should be incompatible
+ checkCompatible(
+ passThrough_a_10.createShuffleSpec(ab),
+ ShufflePartitionIdPassThrough(DirectShufflePartitionID($"c"),
5).createShuffleSpec(cd),
+ expected = false
+ )
+
+ // Mismatched key positions should be incompatible
+ checkCompatible(
+ ShufflePartitionIdPassThrough(DirectShufflePartitionID($"b"),
10).createShuffleSpec(ab),
Review Comment:
nit: can we make passThrough_b_10 and c_10 to reduce duplication?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]