You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "wangyum (via GitHub)" <gi...@apache.org> on 2023/08/03 07:47:52 UTC

[GitHub] [spark] wangyum commented on a diff in pull request #42315: [SPARK-44653][SQL] Non-trivial DataFrame unions should not break caching

wangyum commented on code in PR #42315:
URL: https://github.com/apache/spark/pull/42315#discussion_r1282789589


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -2241,6 +2240,18 @@ class Dataset[T] private[sql](
     Offset(Literal(n), logicalPlan)
   }
 
+  // This breaks caching, but it's usually ok because it addresses a very specific use case:
+  // using union to union many files or partitions.
+  private def combineUnions(u: Union): LogicalPlan = {
+    val newChildren = u.children.flatMap {
+      case child: Union if u.byName == child.byName && u.allowMissingCol == child.allowMissingCol =>
+        child.children
+      case other =>
+        Seq(other)
+    }
+    u.withNewChildren(newChildren)

Review Comment:
   `withNewChildren` needs to ensure the size of children is consistent.  Can we use `Union(newChildren)`?



-- 
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: reviews-unsubscribe@spark.apache.org

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


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