You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/05/13 19:23:08 UTC

[GitHub] [spark] planga82 commented on a change in pull request #32496: [SPARK-35207][SQL] Normalize hash function behavior with negative zero

planga82 commented on a change in pull request #32496:
URL: https://github.com/apache/spark/pull/32496#discussion_r632047996



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/HashExpressionsSuite.scala
##########
@@ -708,6 +708,16 @@ class HashExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
     checkEvaluation(HiveHash(Seq(yearMonth)), 1234)
   }
 
+  test("SPARK-35207: Compute hash consistent between -0.0 and 0.0") {
+    def checkResult(exprs1: Expression, exprs2: Expression): Unit = {
+      assert(Murmur3Hash(Seq(exprs1), 42).eval() == Murmur3Hash(Seq(exprs2), 42).eval())
+      assert(XxHash64(Seq(exprs1), 42).eval() == XxHash64(Seq(exprs2), 42).eval())
+      assert(HiveHash(Seq(exprs1)).eval() == HiveHash(Seq(exprs2)).eval())
+    }
+    checkResult(Literal.create(0D, DoubleType), Literal.create(-0D, DoubleType))

Review comment:
       Oh! thanks, I pretend to put float instead long




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

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



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