viirya commented on a change in pull request #34025:
URL: https://github.com/apache/spark/pull/34025#discussion_r710536085
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSetOperationsSuite.scala
##########
@@ -1018,6 +1018,23 @@ class DataFrameSetOperationsSuite extends QueryTest with
SharedSparkSession {
unionDF = df1.unionByName(df2)
checkAnswer(unionDF, expected)
}
+
+ test("SPARK-36673: Incorrect Unions of struct") {
+ val df1 = spark.range(2).withColumn("nested", struct(expr("id * 5 AS
INNER")))
+ val df2 = spark.range(2).withColumn("nested", struct(expr("id * 5 AS
inner")))
Review comment:
Currently it is always case sensitive for the nested fields in structs
during merging (ref. `StructType.merge`). But for `union`, we don't actually
want to do a struct merging. For `union`, we don't merge the schema of its
children for all cases but resolve columns between them (by position or by
name).
--
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]