LB-Yu commented on code in PR #24104:
URL: https://github.com/apache/flink/pull/24104#discussion_r1464624954


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/batch/BatchPhysicalLookupJoinRule.scala:
##########
@@ -73,7 +75,19 @@ object BatchPhysicalLookupJoinRule {
     val cluster = join.getCluster
 
     val providedTrait = 
join.getTraitSet.replace(FlinkConventions.BATCH_PHYSICAL)
-    val requiredTrait = 
input.getTraitSet.replace(FlinkConventions.BATCH_PHYSICAL)
+    var requiredTrait = 
input.getTraitSet.replace(FlinkConventions.BATCH_PHYSICAL)
+    val partitionJoinHint = join.getHints
+      .stream()
+      .filter(hint => JoinStrategy.isShuffleHashHint(hint.hintName))
+      .findFirst()
+    // if partitioning enabled, use the join key as partition key
+    if (
+      partitionJoinHint.isPresent &&
+      partitionJoinHint.get().listOptions.contains(FlinkHints.RIGHT_INPUT) &&
+      !joinInfo.pairs().isEmpty
+    ) {

Review Comment:
   To keep the code here clean, my suggestion is to abstract the code that 
determines whether to enable SHUFFLE_HASH into `JoinUtil`.



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

Reply via email to