zheniantoushipashi commented on a change in pull request #33201:
URL: https://github.com/apache/spark/pull/33201#discussion_r683234940
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -54,38 +54,38 @@ object Cast {
case (NullType, _) => true
- case (_, StringType) => true
+ case (_, StringType | CharType(_) | VarcharType(_)) => true
Review comment:
the method cast will change the type char/varchar to StringType, so cast
method allows conversion from other types to CHAR/VARCHAR, although a warn
message is printed.


in my application code, I first use the canCast method to determine whether
the type conversion can be performed before calling the cast method for
conversion。
**i think the canCast method muse be consistent with Cast method**
@cloud-fan
--
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]