Search in sources :

Example 1 with JoinCategory

use of org.apache.drill.exec.physical.impl.join.JoinUtils.JoinCategory in project drill by apache.

the class JoinPruleBase method checkPreconditions.

protected boolean checkPreconditions(DrillJoinRel join, RelNode left, RelNode right, PlannerSettings settings) {
    List<Integer> leftKeys = Lists.newArrayList();
    List<Integer> rightKeys = Lists.newArrayList();
    List<Boolean> filterNulls = Lists.newArrayList();
    JoinCategory category = JoinUtils.getJoinCategory(left, right, join.getCondition(), leftKeys, rightKeys, filterNulls);
    return !(category == JoinCategory.CARTESIAN || category == JoinCategory.INEQUALITY);
}
Also used : JoinCategory(org.apache.drill.exec.physical.impl.join.JoinUtils.JoinCategory)

Example 2 with JoinCategory

use of org.apache.drill.exec.physical.impl.join.JoinUtils.JoinCategory in project drill by apache.

the class NestedLoopJoinPrule method checkPreconditions.

@Override
protected boolean checkPreconditions(DrillJoinRel join, RelNode left, RelNode right, PlannerSettings settings) {
    JoinRelType type = join.getJoinType();
    if (!(type == JoinRelType.INNER || type == JoinRelType.LEFT)) {
        return false;
    }
    List<Integer> leftKeys = Lists.newArrayList();
    List<Integer> rightKeys = Lists.newArrayList();
    List<Boolean> filterNulls = Lists.newArrayList();
    JoinCategory category = JoinUtils.getJoinCategory(left, right, join.getCondition(), leftKeys, rightKeys, filterNulls);
    if (category == JoinCategory.EQUALITY && (settings.isHashJoinEnabled() || settings.isMergeJoinEnabled())) {
        return false;
    }
    if (settings.isNlJoinForScalarOnly()) {
        return JoinUtils.hasScalarSubqueryInput(left, right);
    }
    return true;
}
Also used : JoinRelType(org.apache.calcite.rel.core.JoinRelType) JoinCategory(org.apache.drill.exec.physical.impl.join.JoinUtils.JoinCategory)

Aggregations

JoinCategory (org.apache.drill.exec.physical.impl.join.JoinUtils.JoinCategory)2 JoinRelType (org.apache.calcite.rel.core.JoinRelType)1