Skip to content

Commit

Permalink
Fix push limit when join has predicate (#1427) (#1435)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seaven authored Nov 19, 2021
1 parent 14935ad commit b04a782
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ public class RuleSet {
new PushDownLimitJoinRule(),
MergeLimitDirectRule.AGGREGATE,
MergeLimitDirectRule.OLAP_SCAN,
MergeLimitDirectRule.SCHEMA_SCAN,
MergeLimitDirectRule.HIVE_SCAN,
MergeLimitDirectRule.SCHEMA_SCAN,
MergeLimitDirectRule.MYSQL_SCAN,
MergeLimitDirectRule.ES_SCAN,
MergeLimitDirectRule.WINDOW,
MergeLimitDirectRule.JOIN,
MergeLimitDirectRule.INTERSECT,
MergeLimitDirectRule.EXCEPT,
MergeLimitDirectRule.VALUES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class MergeLimitDirectRule extends TransformationRule {
public static final MergeLimitDirectRule ES_SCAN = new MergeLimitDirectRule(OperatorType.LOGICAL_ES_SCAN);
public static final MergeLimitDirectRule WINDOW = new MergeLimitDirectRule(OperatorType.LOGICAL_WINDOW);
public static final MergeLimitDirectRule JOIN = new MergeLimitDirectRule(OperatorType.LOGICAL_JOIN);
public static final MergeLimitDirectRule UNION = new MergeLimitDirectRule(OperatorType.LOGICAL_UNION);
public static final MergeLimitDirectRule INTERSECT = new MergeLimitDirectRule(OperatorType.LOGICAL_INTERSECT);
public static final MergeLimitDirectRule EXCEPT = new MergeLimitDirectRule(OperatorType.LOGICAL_EXCEPT);
public static final MergeLimitDirectRule VALUES = new MergeLimitDirectRule(OperatorType.LOGICAL_VALUES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ public PushDownLimitJoinRule() {
@Override
public boolean check(OptExpression input, OptimizerContext context) {
LogicalLimitOperator limit = (LogicalLimitOperator) input.getOp();
LogicalJoinOperator join = (LogicalJoinOperator) input.getInputs().get(0).getOp();

// 1. Has offset can't push down
return !limit.hasOffset();
// 2. Has predicate can't push down
return !limit.hasOffset() && join.getPredicate() == null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4265,5 +4265,4 @@ public void testPredicateOnRepeatNode() throws Exception {
" PREDICATES: 1: v1 <=> 2: v2"));
FeConstants.runningUnitTest = false;
}

}

0 comments on commit b04a782

Please sign in to comment.