Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18460#discussion_r126287191
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ---
    @@ -144,6 +145,16 @@ object TypeCoercion {
           .orElse((t1, t2) match {
             case (ArrayType(et1, containsNull1), ArrayType(et2, 
containsNull2)) =>
               findWiderTypeForTwo(et1, et2).map(ArrayType(_, containsNull1 || 
containsNull2))
    +        case (st1 @ StructType(fields1), st2 @ StructType(fields2)) if 
st1.sameType(st2) =>
    +          Some(StructType(fields1.zip(fields2).map { case (sf1, sf2) =>
    +            // Since `st1.sameType(st2)` is true, two StructTypes have the 
same DataType
    +            // except `name` (in case of `spark.sql.caseSensitive=false`) 
and `nullable`.
    +            // - Different names: use a lower case name because 
findWiderTypeForTwo is commutative.
    +            // - Different nullabilities: `nullable` is true iff one of 
them is nullable.
    +            val name = if (sf1.name == sf2.name) sf1.name else 
sf1.name.toLowerCase(Locale.ROOT)
    +            val dataType = findWiderTypeForTwo(sf1.dataType, 
sf2.dataType).get
    +            StructField(name, dataType, nullable = sf1.nullable || 
sf2.nullable)
    +          }))
    --- End diff --
    
    Thank you again, @viirya . I updated it.


---
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