srielau commented on code in PR #58130:
URL: https://github.com/apache/spark/pull/58130#discussion_r3836577523
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala:
##########
@@ -649,16 +715,31 @@ abstract class TypeCoercionHelper {
}
e.withNewChildren(children)
+ case j: JsonTuple =>
+ val expected = StringTypeWithCollation(supportsTrimCollation = true)
+ val children = j.children.map { child =>
+ charVarcharToPlainString(child.dataType, expected)
+ .map(dt => if (dt == child.dataType) child else Cast(child, dt))
+ .getOrElse(child)
+ }
+ j.withNewChildren(children)
Review Comment:
This is the right special case: CHAR/VARCHAR only, leave NULL/INT for
JsonTuple's custom `checkInputDataTypes`.
Please add a short comment here so the next change does not fold this into
`ExpectsInputTypes` and revive the NullType rewrite. The JsonTuple class
comment already says this; the match arm is where someone will be tempted to
"simplify".
--
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]