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

[GitHub] [spark] beliefer commented on a diff in pull request #41875: [SPARK-44317][SQL] Use PartitionEvaluator API in ShuffledHashJoinExec

beliefer commented on code in PR #41875:
URL: https://github.com/apache/spark/pull/41875#discussion_r1256929660


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala:
##########
@@ -766,4 +598,331 @@ object HashJoin extends CastSupport with SQLConfHelper {
         ansiEnabled = false)
     }
   }
+
+  private def streamedBoundKeys(streamedKeys: Seq[Expression], streamedOutput: Seq[Attribute]) =
+    bindReferences(HashJoin.rewriteKeyExpr(streamedKeys), streamedOutput)
+  private def streamSideKeyGenerator(
+      streamedKeys: Seq[Expression],
+      streamedOutput: Seq[Attribute]): UnsafeProjection =
+    UnsafeProjection.create(streamedBoundKeys(streamedKeys, streamedOutput))
+
+  def boundCondition(
+      condition: Option[Expression],
+      joinType: JoinType,
+      buildSide: BuildSide,
+      buildPlanOutput: Seq[Attribute],
+      streamedPlanOutput: Seq[Attribute]): InternalRow => Boolean = if (condition.isDefined) {
+    if (joinType == FullOuter && buildSide == BuildLeft) {
+      // Put join left side before right side. This is to be consistent with
+      // `ShuffledHashJoinExec.fullOuterJoin`.
+      Predicate.create(condition.get, buildPlanOutput ++ streamedPlanOutput).eval _
+    } else {
+      Predicate.create(condition.get, streamedPlanOutput ++ buildPlanOutput).eval _
+    }
+  } else { (r: InternalRow) =>
+    true
+  }
+
+  private def createResultProjection(joinType: JoinType,
+             output: Seq[Attribute],

Review Comment:
   Please reduce the indent.



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