Search in sources :

Example 1 with MutableFilter

use of org.apache.calcite.rel.mutable.MutableFilter in project calcite 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.rowType.equals(rel0.rowType)) {
        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.rowType);
    return rexImplicationChecker.implies(((MutableFilter) rel0).condition, ((MutableFilter) rel).condition);
}
Also used : RexExecutorImpl(org.apache.calcite.rex.RexExecutorImpl) MutableFilter(org.apache.calcite.rel.mutable.MutableFilter) MutableRel(org.apache.calcite.rel.mutable.MutableRel)

Aggregations

MutableFilter (org.apache.calcite.rel.mutable.MutableFilter)1 MutableRel (org.apache.calcite.rel.mutable.MutableRel)1 RexExecutorImpl (org.apache.calcite.rex.RexExecutorImpl)1