Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21713#discussion_r200109841
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
---
@@ -185,6 +185,15 @@ object TypeCoercion {
MapType(kt, vt, valueContainsNull1 || valueContainsNull2)
}
}
+ case (StructType(fields1), StructType(fields2)) if fields1.length
== fields2.length =>
--- End diff --
is it time to reduce code duplication now?
```
def mergeComplexTypes(
t1: DataType,
t2: DataType,
mergeFunc: (DataType, DataType) => Option[DataType]): Option[DataType]
= (t1, t2) match {
case (ArrayType(et1, containsNull1), ArrayType(et2, containsNull2)) =>
mergeFunc(et1, et2).map(ArrayType(_, containsNull1 || containsNull2))
...
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]