stefankandic commented on code in PR #47502: URL: https://github.com/apache/spark/pull/47502#discussion_r1693213018
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/hash.scala: ########## @@ -565,7 +565,15 @@ abstract class InterpretedHashFunction { case a: Array[Byte] => hashUnsafeBytes(a, Platform.BYTE_ARRAY_OFFSET, a.length, seed) case s: UTF8String => - hashUnsafeBytes(s.getBaseObject, s.getBaseOffset, s.numBytes(), seed) + dataType match { Review Comment: this code doesn't seem properly formatted ########## 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 Review Comment: won't this check for both codegen and interpreted path for s1? ########## 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() Review Comment: ```suggestion val interpretedHash = Murmur3Hash(Seq(Collate(Literal(s1), collation)), 42).eval() ``` -- 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