You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "jiwen624 (via GitHub)" <gi...@apache.org> on 2026/09/22 19:56:51 UTC

Re: [PR] [SPARK-39031][SQL] Match NaN and NULL pivot values on the PivotFirst fast path [spark]

jiwen624 commented on code in PR #58234:
URL: https://github.com/apache/spark/pull/58234#discussion_r4075856417


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala:
##########
@@ -87,13 +87,25 @@ case class PivotFirst(
 
   override val dataType: DataType = ArrayType(valueDataType)
 
-  private val usesTreeMap: Boolean = !TypeUtils.typeWithProperEquals(pivotColumn.dataType)
+  private val usesOrderingBasedIndex: Boolean = pivotColumn.dataType match {
+    case FloatType | DoubleType => true

Review Comment:
   Good catch, thanks! Changed it in [5657bf5](https://github.com/apache/spark/pull/58234/changes/b8476f30a7025a7ea25daf79e6059e0143121e26): The `float/double` go back to the HashMap and use normalized bits as keys like `CollectSet` does, so NaN and -0.0 still match and lookups stay O(1). The TreeMap is now only used for types without proper equals.



-- 
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-unsubscribe@spark.apache.org

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