cloud-fan commented on code in PR #45422:
URL: https://github.com/apache/spark/pull/45422#discussion_r1525857828
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -702,9 +702,13 @@ abstract class TypeCoercionBase {
}.getOrElse(b) // If there is no applicable conversion, leave
expression unchanged.
case e: ImplicitCastInputTypes if e.inputTypes.nonEmpty =>
- val children: Seq[Expression] = e.children.zip(e.inputTypes).map {
case (in, expected) =>
+ val children: Seq[Expression] = e.children.zip(e.inputTypes).map {
+ case (expr: Expression, StringType) if
expr.dataType.isInstanceOf[StringType] => expr
+ case (expr: Expression, StringTypeBinary | StringTypeBinaryLcase |
StringTypeAnyCollation)
+ if !expr.dataType.isInstanceOf[StringType] =>
+ implicitCast(expr, StringType).getOrElse(expr)
Review Comment:
We should put the fix in `def implicitCast`. Otherwise it looks hacky to
make a special case here.
--
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]