cloud-fan commented on code in PR #50967:
URL: https://github.com/apache/spark/pull/50967#discussion_r2104819560


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala:
##########
@@ -1124,23 +1124,40 @@ case class MapZipWith(left: Expression, right: 
Expression, function: Expression)
 
   private def getKeysWithIndexesFast(keys1: ArrayData, keys2: ArrayData) = {
     val hashMap = new mutable.LinkedHashMap[Any, Array[Option[Int]]]
+    val NaNTracker = Array[Option[Int]](None, None)
     for ((z, array) <- Array((0, keys1), (1, keys2))) {
       var i = 0
       while (i < array.numElements()) {
         val key = array.get(i, keyType)
-        hashMap.get(key) match {
-          case Some(indexes) =>
-            if (indexes(z).isEmpty) {
-              indexes(z) = Some(i)
+        keyType match {
+          case FloatType if key.asInstanceOf[Float].isNaN =>
+            NaNTracker(z) = Some(i)
+          case DoubleType if key.asInstanceOf[Double].isNaN =>
+            NaNTracker(z) = Some(i)
+          case _ =>
+            hashMap.get(key) match {
+              case Some(indexes) =>
+                if (indexes(z).isEmpty) {
+                  indexes(z) = Some(i)
+                }
+              case None =>
+                val indexes = Array[Option[Int]](None, None)
+                indexes(z) = Some(i)
+                hashMap.put(key, indexes)
             }
-          case None =>
-            val indexes = Array[Option[Int]](None, None)
-            indexes(z) = Some(i)
-            hashMap.put(key, indexes)

Review Comment:
   we can also normalize the key before lookup?



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