Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16057#discussion_r90219640
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ---
    @@ -714,6 +714,17 @@ object TypeCoercion {
             // try to find the first one we can implicitly cast.
             case (_, TypeCollection(types)) => types.flatMap(implicitCast(e, 
_)).headOption.orNull
     
    +        case (ArrayType(_, nullable), ArrayType(internalType: DataType, 
expectedNullable))
    +          if (expectedNullable || nullable == expectedNullable) =>
    --- End diff --
    
    @HyukjinKwon the idea is that returning `None` means that we should not 
cast at all. Returning the same type would mean that we could cast. This is 
only relevant for `ArrayType` case, because we could only change the 
nullability of the column, e.g.: `Cast(a, ArrayType(DoubleType, false), 
ArrayType(DoubleType, true))`
    
    Replacing the `collect { ... }` by a `map { ... }` changes the semantic of 
the `implicitCast(...)` function, and will probably break the 
[`ResolveTableValuedFunctions`](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveTableValuedFunctions.scala#L39-L49)
 rule.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to