cloud-fan commented on code in PR #50343:
URL: https://github.com/apache/spark/pull/50343#discussion_r2007022289
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala:
##########
@@ -133,19 +133,23 @@ object Cast extends QueryErrorsBase {
// to convert data of these types to Variant Objects.
case (_, VariantType) => variant.VariantGet.checkDataType(from,
allowStructsAndMaps = false)
+ // non-null variants can generate nulls even in ANSI mode
case (ArrayType(fromType, fn), ArrayType(toType, tn)) =>
- canAnsiCast(fromType, toType) && resolvableNullability(fn, tn)
+ canAnsiCast(fromType, toType) && resolvableNullability(fn || (fromType
== VariantType), tn)
Review Comment:
I think what we want to do is to follow `Cast.canCast`
```
case (ArrayType(fromType, fn), ArrayType(toType, tn)) =>
canCast(fromType, toType) &&
resolvableNullability(fn || forceNullable(fromType, toType), tn)
```
`fromType == VariantType` makes sense, but shall we consider the deeply
nested cases like array of array of variant?
--
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]