morrySnow commented on code in PR #12571:
URL: https://github.com/apache/doris/pull/12571#discussion_r971502707
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushPredicatesThroughJoin.java:
##########
@@ -21,103 +21,128 @@
import org.apache.doris.nereids.rules.RuleType;
import org.apache.doris.nereids.rules.rewrite.OneRewriteRuleFactory;
import org.apache.doris.nereids.trees.expressions.ComparisonPredicate;
+import org.apache.doris.nereids.trees.expressions.EqualTo;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Slot;
-import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral;
import org.apache.doris.nereids.trees.plans.GroupPlan;
+import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
import org.apache.doris.nereids.util.ExpressionUtils;
import org.apache.doris.nereids.util.PlanUtils;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Objects;
import java.util.Set;
/**
- * Push the predicate in the LogicalFilter or LogicalJoin to the join children.
- * todo: Now, only support eq on condition for inner join, support other case
later
+ * Push the predicate in the LogicalFilter to the join children.
*/
-public class PushPredicateThroughJoin extends OneRewriteRuleFactory {
+public class PushPredicatesThroughJoin extends OneRewriteRuleFactory {
+
+ private static final ImmutableList<JoinType> COULD_PUSH_THROUGH_LEFT =
ImmutableList.of(
+ JoinType.INNER_JOIN,
+ JoinType.LEFT_OUTER_JOIN,
+ JoinType.LEFT_SEMI_JOIN,
+ JoinType.LEFT_ANTI_JOIN,
+ JoinType.CROSS_JOIN
+ );
+
+ private static final ImmutableList<JoinType> COULD_PUSH_THROUGH_RIGHT =
ImmutableList.of(
+ JoinType.INNER_JOIN,
+ JoinType.RIGHT_OUTER_JOIN,
+ JoinType.RIGHT_SEMI_JOIN,
+ JoinType.RIGHT_ANTI_JOIN,
+ JoinType.CROSS_JOIN
+ );
+
+ private static final ImmutableList<JoinType> COULD_PUSH_EQUAL_TO =
ImmutableList.of(
+ JoinType.INNER_JOIN
+ );
+
/*
* For example:
* select a.k1,b.k1 from a join b on a.k1 = b.k1 and a.k2 > 2 and b.k2 > 5
where a.k1 > 1 and b.k1 > 2
Review Comment:
fix it
--
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]