viirya commented on a change in pull request #28996:
URL: https://github.com/apache/spark/pull/28996#discussion_r449933260



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSetOperationsSuite.scala
##########
@@ -506,4 +506,23 @@ class DataFrameSetOperationsSuite extends QueryTest with 
SharedSparkSession {
     check(lit(2).cast("int"), $"c" === 2, Seq(Row(1, 1, 2, 0), Row(1, 1, 2, 
1)))
     check(lit(2).cast("int"), $"c" =!= 2, Seq())
   }
+
+  test("SPARK-29358: Make unionByName optionally fill missing columns with 
nulls") {
+    withSQLConf(SQLConf.ALLOW_MISSING_COLUMNS_IN_UNION_BY_NAME.key -> "true") {
+      var df1 = Seq(1, 2, 3).toDF("a")
+      var df2 = Seq(3, 1, 2).toDF("b")
+      val df3 = Seq(2, 3, 1).toDF("c")
+      val unionDf = df1.unionByName(df2.unionByName(df3))

Review comment:
       This shows the behavior of enabling this config. Yeah, it looks like to 
merge the schema of different datasets.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to