stefankandic commented on code in PR #47502:
URL: https://github.com/apache/spark/pull/47502#discussion_r1693220878


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/HashExpressionsSuite.scala:
##########
@@ -620,6 +620,33 @@ class HashExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     checkHiveHashForDecimal("123456.123456789012345678901234567890", 38, 31, 
1728235666)
   }
 
+  for (collation <- Seq("UTF8_LCASE", "UNICODE_CI")) {
+    test(s"hash equality for collated $collation strings") {
+      val s1 = "aaa"
+      val s2 = "AAA"
+
+      // Interpreted hash value for s1
+      val hash = Murmur3Hash(Seq(Collate(Literal(s1), collation)), 42).eval()
+
+      // Check if interpreted hash value is same as codegen for s1
+      checkEvaluation(Murmur3Hash(Seq(Collate(Literal(s1), collation)), 42), 
hash)
+      // Check if s2's interpreted and codegen hash values are same as s1's
+      checkEvaluation(Murmur3Hash(Seq(Collate(Literal(s2), collation)), 42), 
hash)
+    }
+  }
+
+  for (collation <- Seq("UTF8_BINARY", "UNICODE")) {

Review Comment:
   could you maybe combine these tests and just check if the collation 
`supportsBinaryEquality` and do different checks based on that?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to