mihailom-db commented on code in PR #48585:
URL: https://github.com/apache/spark/pull/48585#discussion_r1815655287


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -1014,7 +1016,9 @@ object TypeCoercion extends TypeCoercionBase {
       case (_: StringType, datetime: DatetimeType) => datetime
       case (_: StringType, AnyTimestampType) => 
AnyTimestampType.defaultConcreteType
       case (_: StringType, BinaryType) => BinaryType
-      // Cast any atomic type to string.
+      // Cast any atomic type to string except if there are strings with 
different collations. In
+      // that case we skip the cast.
+      case (st1: StringType, st2: StringType) if st1.collationId != 
st2.collationId => null

Review Comment:
   This seems like we are adding something unnecessary. The comment said we 
cast any atomic type and that rule is checking for whether any is instance of 
StringType, so we cannot hit this by any rule below actually, so we should be 
fine with getting the default which is null? I am good with adding additional 
comment as to why we do not cast StringType in the existing rule, but this is 
just moving the default branch earlier.



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