dbatomic commented on code in PR #45383:
URL: https://github.com/apache/spark/pull/45383#discussion_r1530283087


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -764,6 +770,177 @@ abstract class TypeCoercionBase {
     }
   }
 
+  object CollationTypeCasts extends TypeCoercionRule {
+    override val transform: PartialFunction[Expression, Expression] = {
+      case e if !e.childrenResolved => e
+
+      case checkCastWithIndeterminate: Concat

Review Comment:
   AFAIK it is part of the spec and PGSQL has the same behavior - @srielau as 
FYI.
   
   Idea is that you can have indeterminate collations as the result of some 
expressions (not sure what else is there outside of concat?). Such strings 
can't be pushed to storage and most expressions don't accept it as an input. 
But you can do concat across different collations and then cast final output to 
the final collation.
   
   That being said - all of this is far from obvious and I think that you at 
least need some comments in the code that explain this. I would also prefer new 
trait for this, even though `concat` is the only user.
   
   



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