zabetak commented on a change in pull request #2349:
URL: https://github.com/apache/calcite/pull/2349#discussion_r579834067
##########
File path: core/src/main/java/org/apache/calcite/rel/core/JoinRelType.java
##########
@@ -152,4 +152,29 @@ public JoinRelType cancelNullsOnRight() {
public boolean projectsRight() {
return this != SEMI && this != ANTI;
}
+
+ /** Returns whether this join type accepts pushing predicates from above
into its predicate. */
+ public boolean canPushIntoFromAbove() {
+ return (this == INNER) || (this == SEMI);
+ }
+
+ /** Returns whether this join type accepts pushing predicates from above
into its left input. */
+ public boolean canPushLeftFromAbove() {
+ return (this == INNER) || (this == LEFT) || (this == SEMI) || (this ==
ANTI);
+ }
+
+ /** Returns whether this join type accepts pushing predicates from above
into its right input. */
+ public boolean canPushRightFromAbove() {
+ return (this == INNER) || (this == RIGHT);
+ }
+
+ /** Returns whether this join type accepts pushing predicates from within
into its left input. */
+ public boolean canPushLeftFromWithin() {
+ return (this == INNER) || (this == RIGHT) || (this == SEMI);
+ }
+
+ /** Returns whether this join type accepts pushing predicates from within
into its right input. */
+ public boolean canPushRightFromWithin() {
+ return (this == INNER) || (this == LEFT) || (this == SEMI);
+ }
Review comment:
These new methods in `JoinRelType` are used only for feeding
`RelOptUtil#classifyFilters` method so I am not sure if it is the best place to
put them here but I don't have a better idea at the moment. I would suggest to
mark them as experimental to have some flexibility if we find a better approach
in the near future. WDYT?
##########
File path: core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
##########
@@ -2821,8 +2941,8 @@ public static boolean classifyFilters(
// SemiJoin, CorrelateSemiJoin, CorrelateAntiJoin: right fields are not
returned
assert nTotalFields == (!joinType.projectsRight()
- ? nSysFields + nFieldsLeft
- : nSysFields + nFieldsLeft + nFieldsRight);
+ ? nSysFields + nFieldsLeft
+ : nSysFields + nFieldsLeft + nFieldsRight);
Review comment:
nit: formatting?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]