Search in sources :

Example 1 with RexImplicationChecker

use of org.apache.calcite.plan.RexImplicationChecker in project hive by apache.

the class SubstitutionVisitor method isWeaker.

/** Returns if one rel is weaker than another. */
protected boolean isWeaker(MutableRel rel0, MutableRel rel) {
    if (rel0 == rel || equivalents.get(rel0).contains(rel)) {
        return false;
    }
    if (!(rel0 instanceof MutableFilter) || !(rel instanceof MutableFilter)) {
        return false;
    }
    if (!rel.getRowType().equals(rel0.getRowType())) {
        return false;
    }
    final MutableRel rel0input = ((MutableFilter) rel0).getInput();
    final MutableRel relinput = ((MutableFilter) rel).getInput();
    if (rel0input != relinput && !equivalents.get(rel0input).contains(relinput)) {
        return false;
    }
    RexExecutorImpl rexImpl = (RexExecutorImpl) (rel.cluster.getPlanner().getExecutor());
    RexImplicationChecker rexImplicationChecker = new RexImplicationChecker(rel.cluster.getRexBuilder(), rexImpl, rel.getRowType());
    return rexImplicationChecker.implies(((MutableFilter) rel0).getCondition(), ((MutableFilter) rel).getCondition());
}
Also used : RexExecutorImpl(org.apache.calcite.rex.RexExecutorImpl) RexImplicationChecker(org.apache.calcite.plan.RexImplicationChecker)

Aggregations

RexImplicationChecker (org.apache.calcite.plan.RexImplicationChecker)1 RexExecutorImpl (org.apache.calcite.rex.RexExecutorImpl)1