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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2721,6 +2721,16 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val UNION_BYNAME_STRUCT_SUPPORT_ENABLED =
+    buildConf("spark.sql.unionByName.structSupport.enabled")
+      .doc("When true, the `allowMissingColumns` feature of 
`Dataset.unionByName` supports " +
+        "nested column in struct types. Missing nested columns of struct 
columns with same " +
+        "name will also be filled with null values. This currently does not 
support nested " +
+        "columns in array and map types.")

Review comment:
       To have a consistent schema but not just sorting the fields, top-level 
case is much easier. We just iterate each top-level column of left side, and in 
the end putting the fields only existing in right side at the end of schema. 
Then it is done.
   
   For nested column case, filling missing nested columns is done by using 
`WithFields` which basically adds new columns in the end of original schema. To 
achieve same consistent schema like top-level column case, we either adjust all 
nested columns later or simply sort nested columns.
   
   I believe it is not unable to adjust the nested columns to have a more 
natural schema. But I can see this PR grows too big and I would like to cut it 
early. If you are okay, I can address this issue in other PR after this. WDYT?




----------------------------------------------------------------
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:
[email protected]



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

Reply via email to