harshmotw-db commented on code in PR #50343:
URL: https://github.com/apache/spark/pull/50343#discussion_r2007995933
##########
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 don't know if non-null `array<variant>` can cast to null. Yeah, I think
resolveNullability is also complete in this case but only the variant case
would apply in resolveNullability because every other type that fails in
resolveNullability would also fail in canAnsiCast. I'll change it to
resolveNullability.
--
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]