zheniantoushipashi opened a new pull request #33201:
URL: https://github.com/apache/spark/pull/33201
### What changes were proposed in this pull request?
The canCast method of type of char/varchar is modified to be consistent with
StringType
the method cast will change the type char/varchar to StringType
def cast(to: DataType): Column = withExpr {
val cast = Cast(expr,
CharVarcharUtils.replaceCharVarcharWithStringForCast(to))
cast.setTagValue(Cast.USER_SPECIFIED_CAST, true)
cast
}
The canCast method of type of char/varchar must be consistent with
StringType
### Why are the changes needed?
Before I used stringType instead of char/varchar, my application code has
the logic to judge using canCast. There was no problem before, but now it’s
changed to char/varchar, and the judgment of canCast fails. If it doesn’t pass,
I Need to change a lot of application code
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
i add UT。
--
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]