dbatomic commented on code in PR #46597: URL: https://github.com/apache/spark/pull/46597#discussion_r1626058908
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala: ########## @@ -74,16 +90,25 @@ case class Mode( if (buffer.isEmpty) { return null } - + val collationAwareBuffer = child.dataType match { + case c: StringType if + !CollationFactory.fetchCollation(c.collationId).supportsBinaryEquality => + val collationId = c.collationId + val modeMap = buffer.toSeq.groupMapReduce { Review Comment: I am not expert in this part of code but I wander if we could do better than this. I see that most of the logic is in `OpenHashMap` and `OpenHashSet`. In `OpenHashSet` hash calc is usually done like this `hashcode(hasher.hash(k))`. If we just could get hash to respect collation problem might be solved. On collation level we do have `Collation.hashFunction`. Can we somehow pass this to the `OpenHashSet`? -- 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