diff options
author | Hanumath Maduri <hmaduri@apache.org> | 2019-01-11 20:17:47 -0800 |
---|---|---|
committer | Aman Sinha <asinha@maprtech.com> | 2019-02-01 10:14:51 -0800 |
commit | 982e98061e029a39f1c593f695c0d93ec7079f0d (patch) | |
tree | 93f70d6d0bb1750011e7b9f34e6fd7f6f4b631a7 /exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical | |
parent | 8fb85cd4370e6143641cda1ad5b998caca0b6bf7 (diff) |
DRILL-6997: Semijoin is changing the join ordering for some tpcds queries.
close apache/drill#1620
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical')
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java | 58 |
1 files changed, 2 insertions, 56 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java index 2581fa667..f29daa3e0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java @@ -21,10 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.apache.calcite.rex.RexChecker; -import org.apache.calcite.sql.type.SqlTypeName; -import org.apache.calcite.sql.validate.SqlValidatorUtil; -import org.apache.calcite.util.Litmus; + import org.apache.drill.common.exceptions.UserException; import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.logical.data.JoinCondition; @@ -162,58 +159,7 @@ public abstract class JoinPrel extends DrillJoinRelBase implements Prel { return isSemiJoin; } - /* A Drill physical rel which is semi join will have output row type with fields from only - left side of the join. Calcite's join rel expects to have the output row type from - left and right side of the join. This function is overloaded to not throw exceptions for - a Drill semi join physical rel. - */ - @Override public boolean isValid(Litmus litmus, Context context) { - if (!this.isSemiJoin && !super.isValid(litmus, context)) { - return false; - } - if (getRowType().getFieldCount() - != getSystemFieldList().size() - + left.getRowType().getFieldCount() - + (this.isSemiJoin ? 0 : right.getRowType().getFieldCount())) { - return litmus.fail("field count mismatch"); - } - if (condition != null) { - if (condition.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) { - return litmus.fail("condition must be boolean: {}", - condition.getType()); - } - // The input to the condition is a row type consisting of system - // fields, left fields, and right fields. Very similar to the - // output row type, except that fields have not yet been made due - // due to outer joins. - RexChecker checker = - new RexChecker( - getCluster().getTypeFactory().builder() - .addAll(getSystemFieldList()) - .addAll(getLeft().getRowType().getFieldList()) - .addAll(getRight().getRowType().getFieldList()) - .build(), - context, litmus); - condition.accept(checker); - if (checker.getFailureCount() > 0) { - return litmus.fail(checker.getFailureCount() - + " failures in condition " + condition); - } - } - return litmus.succeed(); - } - @Override public RelDataType deriveRowType() { - if (isSemiJoin) { - return SqlValidatorUtil.deriveJoinRowType( - left.getRowType(), - null, - this.joinType, - getCluster().getTypeFactory(), - null, - new ArrayList<>()); - } else { - return super.deriveRowType(); - } + return super.deriveRowType(); } } |