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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PivotFirst.scala:
##########
@@ -88,11 +89,27 @@ case class PivotFirst(
 
   private val usesTreeMap: Boolean = 
!TypeUtils.typeWithProperEquals(pivotColumn.dataType)
 
-  val pivotIndex: Map[Any, Int] = if (usesTreeMap) {
-    TreeMap(pivotColumnValues.zipWithIndex: _*)(
-      TypeUtils.getInterpretedOrdering(pivotColumn.dataType))
-  } else {
-    HashMap(pivotColumnValues.zipWithIndex: _*)
+  // Every pivot value gets a buffer slot, shared between the values that 
compare as equal, so a
+  // repeated value does not shrink the buffer below the number of output 
columns.

Review Comment:
   Thanks for pointing it out 👍 . Yes these comments are outdated/wrong and are 
redundant. I chose to remove this and the other duplicate ones in the test file 
and keep the comment before the indexSize 
[definition](https://github.com/apache/spark/pull/58235/changes#diff-6aa83eca8faa4e7471ed6917f26bb64d0da12100a8cbe3299085145cb26f2821R122-R123)
 to remove the redundancy.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to