c21 commented on a change in pull request #35529:
URL: https://github.com/apache/spark/pull/35529#discussion_r806676280



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/DistributionSuite.scala
##########
@@ -265,4 +267,80 @@ class DistributionSuite extends SparkFunSuite {
       ClusteredDistribution(Seq($"a", $"b", $"c"), Some(5)),
       false)
   }
+
+  test("Structured Streaming output partitioning and distribution") {
+    // Validate HashPartitioning.partitionIdExpression to be exactly expected 
format, because
+    // Structured Streaming state store requires it to be consistent across 
Spark versions.
+    val expressions = Seq($"a", $"b", $"c")
+    val hashPartitioning = HashPartitioning(expressions, 10)
+    hashPartitioning.partitionIdExpression match {
+      case Pmod(Murmur3Hash(es, 42), Literal(10, IntegerType), _) =>
+        assert(es.length == expressions.length && es.zip(expressions).forall {
+          case (l, r) => l.semanticEquals(r)
+        })
+      case x => fail(s"Unexpected partitionIdExpression $x for 
$hashPartitioning")
+    }
+
+    // Validate only HashPartitioning (and HashPartitioning in 
PartitioningCollection) can satisfy

Review comment:
       Covered all subclasses of `Partitioning` here, except 
`DataSourcePartitioning`, because `DataSourcePartitioning` is not accessible 
from this unit test.




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

Reply via email to