peter-toth commented on code in PR #54335:
URL: https://github.com/apache/spark/pull/54335#discussion_r2815705708


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala:
##########
@@ -96,28 +97,23 @@ case class BroadcastHashJoinExec private(
   }
 
   // Expands the given partitioning collection recursively.

Review Comment:
   Indeed. I fixed the comments in 
https://github.com/apache/spark/pull/54335/commits/3d75c6b3a4399621afe52bc425a3112d14b5568a.



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala:
##########
@@ -96,28 +97,23 @@ case class BroadcastHashJoinExec private(
   }
 
   // Expands the given partitioning collection recursively.
-  private def expandOutputPartitioning(
-      partitioning: PartitioningCollection): PartitioningCollection = {
-    PartitioningCollection(partitioning.partitionings.flatMap {
-      case h: HashPartitioningLike => expandOutputPartitioning(h).partitionings
-      case c: PartitioningCollection => Seq(expandOutputPartitioning(c))
+  private def expandOutputPartitioning(partitioning: Partitioning): 
Seq[Partitioning] = {
+    partitioning match {
+      case c: PartitioningCollection => 
c.partitionings.flatMap(expandOutputPartitioning)
+      case p: Partitioning with Expression =>
+        // Expands the given partitioning by substituting streamed keys with 
build keys.
+        // For example, if the expressions for the given partitioning are 
Seq("a", "b", "c")
+        // where the streamed keys are Seq("b", "c") and the build keys are 
Seq("x", "y"),
+        // the expanded partitioning will have the following expressions:
+        // Seq("a", "b", "c"), Seq("a", "b", "y"), Seq("a", "x", "c"), 
Seq("a", "x", "y").
+        // The expanded expressions are returned as PartitioningCollection.

Review Comment:
   Fixed in 
https://github.com/apache/spark/pull/54335/commits/3d75c6b3a4399621afe52bc425a3112d14b5568a.



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

Reply via email to