gustavodemorais commented on code in PR #26702:
URL: https://github.com/apache/flink/pull/26702#discussion_r2156784343
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/JoinToMultiJoinRule.java:
##########
@@ -546,12 +557,140 @@ private boolean canCombine(
} else {
return false;
}
- return true;
+ return haveCommonJoinKey(origJoin, join);
} else {
return false;
}
}
+ /**
+ * Checks if original Join and child multi-join have common join keys.
+ *
+ * @param origJoin original Join
+ * @param otherJoin child MultiJoin
+ * @return true if original Join and child multi-join have at least one
common JoinKey
+ */
+ private boolean haveCommonJoinKey(Join origJoin, MultiJoin otherJoin) {
+ Set<String> origJoinKeys = getJoinKeys(origJoin);
+ Set<String> otherJoinKeys = getJoinKeys(otherJoin);
+
+ origJoinKeys.retainAll(otherJoinKeys);
+
+ return !origJoinKeys.isEmpty();
+ }
+
+ /**
+ * Gives set of join keys as strings like [table_name.field_name].
Review Comment:
Suggestion: `Returns a set of join keys as strings following this format
[table_name.field_name].`
--
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]