jovanm-db commented on code in PR #49340: URL: https://github.com/apache/spark/pull/49340#discussion_r1907093911
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AnsiTypeCoercion.scala: ########## @@ -168,7 +171,12 @@ object AnsiTypeCoercion extends TypeCoercionBase { // If a function expects a StringType, no StringType instance should be implicitly cast to // StringType with a collation that's not accepted (aka. lockdown unsupported collations). - case (_: StringType, _: StringType) => None + case (s1: StringType, s2: StringType) => + if (s1.collationId == s2.collationId && StringHelper.isMoreConstrained(s1, s2)) { Review Comment: If `s1` is for example `char(5)` and `s2` is `char(2)` then `StringHelper.tightestCommonString(s1, s2)` is `char(5)`; however, in this example `s1` should not implicitly cast into `s2` -- 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