GideonPotok commented on code in PR #46597:
URL: https://github.com/apache/spark/pull/46597#discussion_r1604942334


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala:
##########
@@ -41,6 +42,11 @@ case class Mode(
     this(child, 0, 0, Some(reverse))
   }
 
+  final lazy val collationId: Int = child.dataType match {

Review Comment:
   if we use `asInstanceOf[StringType]` we will get an exception whenever the 
child is a numerical type or any non-string type.
   
   It would be ideal in the case of a non-string type if collationId could be 
-1 or something, but then CollationFactory.fetchCollation(collationId) would 
throw an exception. But it really is not precise to be relying on 
`!CollationFactory.fetchCollation(CollationFactory.UTF8_BINARY_COLLATION_ID).supportsBinaryEquality`
 when it is a non-string-type to continue with the non-collation logic.



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