org.apache.calcite.util.Litmus - java examples

Here are the examples of the java api org.apache.calcite.util.Litmus taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

52 Examples 7

19 View Complete Implementation : SqlNode.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether two lists of operands are equal.
 */
public static boolean equalDeep(List<SqlNode> operands0, List<SqlNode> operands1, Litmus litmus) {
    if (operands0.size() != operands1.size()) {
        return litmus.fail(null);
    }
    for (int i = 0; i < operands0.size(); i++) {
        if (!SqlNode.equalDeep(operands0.get(i), operands1.get(i), litmus)) {
            return litmus.fail(null);
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlPostfixOperator.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean validRexOperands(int count, Litmus litmus) {
    if (count != 1) {
        return litmus.fail("wrong operand count {} for {}", count, this);
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlAlienSystemTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec node, Litmus litmus) {
    if (!(node instanceof SqlAlienSystemTypeNameSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlAlienSystemTypeNameSpec that = (SqlAlienSystemTypeNameSpec) node;
    if (!Objects.equals(this.typeAlias, that.typeAlias)) {
        return litmus.fail("{} != {}", this, node);
    }
    return super.equalsDeep(node, litmus);
}

19 View Complete Implementation : SqlDataTypeSpec.java
Copyright Apache License 2.0
Author : lealone
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlDataTypeSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlDataTypeSpec that = (SqlDataTypeSpec) node;
    if (!SqlNode.equalDeep(this.collectionsTypeName, that.collectionsTypeName, litmus)) {
        return litmus.fail(null);
    }
    if (!this.typeName.equalsDeep(that.typeName, litmus)) {
        return litmus.fail(null);
    }
    if (this.precision != that.precision) {
        return litmus.fail("{} != {}", this, node);
    }
    if (this.scale != that.scale) {
        return litmus.fail("{} != {}", this, node);
    }
    if (!Objects.equals(this.timeZone, that.timeZone)) {
        return litmus.fail("{} != {}", this, node);
    }
    if (!Objects.equals(this.charSetName, that.charSetName)) {
        return litmus.fail("{} != {}", this, node);
    }
    return litmus.succeed();
}

19 View Complete Implementation : RowKeyJoinRel.java
Copyright Apache License 2.0
Author : apache
/**
 * The parent method relies the clreplaced being an instance of {@link org.apache.calcite.rel.core.SemiJoin}
 * in deciding row-type validity. We override this method to account for the RowKeyJoinRel logical rel
 * representing both regular and semi-joins
 */
@Override
public boolean isValid(Litmus litmus, Context context) {
    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();
}

19 View Complete Implementation : HintStrategyTable.java
Copyright Apache License 2.0
Author : apache
/**
 * {@code HintStrategy} collection indicates which kind of
 * {@link org.apache.calcite.rel.RelNode} a hint can apply to.
 *
 * <p>Typically, every supported hint should register a {@code HintStrategy}
 * into this collection. For example, {@link HintStrategies#JOIN} implies that this hint
 * would be propagated and attached to the {@link org.apache.calcite.rel.core.Join}
 * relational expressions.
 *
 * <p>A {@code HintStrategy} can be used independently or cascaded with other strategies
 * with method {@link HintStrategies#and}.
 *
 * <p>The matching for hint name is case in-sensitive.
 *
 * @see HintStrategy
 */
public clreplaced HintStrategyTable {

    // ~ Static fields/initializers ---------------------------------------------
    /**
     * Empty strategies.
     */
    // Need to replace the EMPTY with DEFAULT if we have any hint implementations.
    public static final HintStrategyTable EMPTY = new HintStrategyTable(Collections.emptyMap(), Collections.emptyMap(), HintErrorLogger.INSTANCE);

    // ~ Instance fields --------------------------------------------------------
    /**
     * Mapping from hint name to strategy.
     */
    private final Map<Key, HintStrategy> hintStrategyMap;

    /**
     * Mapping from hint name to option checker.
     */
    private final Map<Key, HintOptionChecker> hintOptionCheckerMap;

    /**
     * Handler for the hint error.
     */
    private final Litmus errorHandler;

    private HintStrategyTable(Map<Key, HintStrategy> strategies, Map<Key, HintOptionChecker> optionCheckers, Litmus litmus) {
        this.hintStrategyMap = ImmutableMap.copyOf(strategies);
        this.hintOptionCheckerMap = ImmutableMap.copyOf(optionCheckers);
        this.errorHandler = litmus;
    }

    // ~ Methods ----------------------------------------------------------------
    /**
     * Apply this {@link HintStrategyTable} to the given relational
     * expression for the {@code hints}.
     *
     * @param hints Hints that may attach to the {@code rel}
     * @param rel   Relational expression
     * @return A hints list that can be attached to the {@code rel}
     */
    public List<RelHint> apply(List<RelHint> hints, RelNode rel) {
        return hints.stream().filter(relHint -> canApply(relHint, rel)).collect(Collectors.toList());
    }

    /**
     * Checks if the given hint is valid.
     *
     * @param hint The hint
     */
    public boolean validateHint(RelHint hint) {
        final Key key = Key.of(hint.hintName);
        boolean hintExists = this.errorHandler.check(this.hintStrategyMap.containsKey(key), "Hint: {} should be registered in the {}", hint.hintName, this.getClreplaced().getSimpleName());
        if (!hintExists) {
            return false;
        }
        if (this.hintOptionCheckerMap.containsKey(key)) {
            return this.hintOptionCheckerMap.get(key).checkOptions(hint, this.errorHandler);
        }
        return true;
    }

    private boolean canApply(RelHint hint, RelNode rel) {
        final Key key = Key.of(hint.hintName);
        replacedert this.hintStrategyMap.containsKey(key);
        return this.hintStrategyMap.get(key).canApply(hint, rel);
    }

    /**
     * @return A strategies builder
     */
    public static Builder builder() {
        return new Builder();
    }

    // ~ Inner Clreplaced ------------------------------------------------------------
    /**
     * Key used to keep the strategies which ignores the case sensitivity.
     */
    private static clreplaced Key {

        private String name;

        private Key(String name) {
            this.name = name;
        }

        static Key of(String name) {
            return new Key(name.toLowerCase(Locale.ROOT));
        }

        @Override
        public boolean equals(Object obj) {
            if (!(obj instanceof Key)) {
                return false;
            }
            return Objects.equals(this.name, ((Key) obj).name);
        }

        @Override
        public int hashCode() {
            return this.name.hashCode();
        }
    }

    /**
     * Builder for {@code HintStrategyTable}.
     */
    public static clreplaced Builder {

        private Map<Key, HintStrategy> hintStrategyMap;

        private Map<Key, HintOptionChecker> hintOptionCheckerMap;

        private Litmus errorHandler;

        private Builder() {
            this.hintStrategyMap = new HashMap<>();
            this.hintOptionCheckerMap = new HashMap<>();
            this.errorHandler = HintErrorLogger.INSTANCE;
        }

        public Builder addHintStrategy(String hintName, HintStrategy strategy) {
            this.hintStrategyMap.put(Key.of(hintName), Objects.requireNonNull(strategy));
            return this;
        }

        public Builder addHintStrategy(String hintName, HintStrategy strategy, HintOptionChecker optionChecker) {
            this.hintStrategyMap.put(Key.of(hintName), Objects.requireNonNull(strategy));
            this.hintOptionCheckerMap.put(Key.of(hintName), Objects.requireNonNull(optionChecker));
            return this;
        }

        /**
         * Sets an error handler to customize the hints error handling.
         *
         * <p>The default behavior is to log warnings.
         *
         * @param errorHandler The handler
         */
        public Builder errorHandler(Litmus errorHandler) {
            this.errorHandler = errorHandler;
            return this;
        }

        public HintStrategyTable build() {
            return new HintStrategyTable(this.hintStrategyMap, this.hintOptionCheckerMap, this.errorHandler);
        }
    }

    /**
     * Implementation of {@link org.apache.calcite.util.Litmus} that returns
     * a status code, it logs warnings for fail check and does not throw.
     */
    public static clreplaced HintErrorLogger implements Litmus {

        private static final Logger LOGGER = CalciteTrace.PARSER_LOGGER;

        public static final HintErrorLogger INSTANCE = new HintErrorLogger();

        public boolean fail(String message, Object... args) {
            LOGGER.warn(message, args);
            return false;
        }

        public boolean succeed() {
            return true;
        }

        public boolean check(boolean condition, String message, Object... args) {
            if (condition) {
                return succeed();
            } else {
                return fail(message, args);
            }
        }
    }
}

19 View Complete Implementation : SqlNodeList.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlNodeList)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlNodeList that = (SqlNodeList) node;
    if (this.size() != that.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < list.size(); i++) {
        SqlNode thisChild = list.get(i);
        final SqlNode thatChild = that.list.get(i);
        if (!thisChild.equalsDeep(thatChild, litmus)) {
            return litmus.fail(null);
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : Correlate.java
Copyright Apache License 2.0
Author : apache
// ~ Methods ----------------------------------------------------------------
@Override
public boolean isValid(Litmus litmus, Context context) {
    return super.isValid(litmus, context) && RelOptUtil.notContainsCorrelation(left, correlationId, litmus);
}

19 View Complete Implementation : SqlTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether this spec is structurally equivalent to another spec.
 */
public abstract boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus);

19 View Complete Implementation : SqlBinaryOperator.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean validRexOperands(int count, Litmus litmus) {
    if (count != 2) {
        // Special exception for AND and OR.
        if ((this == SqlStdOperatorTable.AND || this == SqlStdOperatorTable.OR) && count > 2) {
            return true;
        }
        return litmus.fail("wrong operand count {} for {}", count, this);
    }
    return litmus.succeed();
}

19 View Complete Implementation : Calc.java
Copyright Apache License 2.0
Author : lealone
public boolean isValid(Litmus litmus, Context context) {
    if (!RelOptUtil.equal("program's input type", program.getInputRowType(), "child's output type", getInput().getRowType(), litmus)) {
        return litmus.fail(null);
    }
    if (!program.isValid(litmus, context)) {
        return litmus.fail(null);
    }
    if (!program.isNormalized(litmus, getCluster().getRexBuilder())) {
        return litmus.fail(null);
    }
    return litmus.succeed();
}

19 View Complete Implementation : ExtendedSqlRowTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec node, Litmus litmus) {
    if (!(node instanceof SqlRowTypeNameSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    ExtendedSqlRowTypeNameSpec that = (ExtendedSqlRowTypeNameSpec) node;
    if (this.fieldNames.size() != that.fieldNames.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < fieldNames.size(); i++) {
        if (!this.fieldNames.get(i).equalsDeep(that.fieldNames.get(i), litmus)) {
            return litmus.fail("{} != {}", this, node);
        }
    }
    if (this.fieldTypes.size() != that.fieldTypes.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < fieldTypes.size(); i++) {
        if (!this.fieldTypes.get(i).equals(that.fieldTypes.get(i))) {
            return litmus.fail("{} != {}", this, node);
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlDynamicParam.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlDynamicParam)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlDynamicParam that = (SqlDynamicParam) node;
    if (this.index != that.index) {
        return litmus.fail("{} != {}", this, node);
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlNode.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether this node is structurally equivalent to another node.
 * Some examples:
 *
 * <ul>
 * <li>1 + 2 is structurally equivalent to 1 + 2</li>
 * <li>1 + 2 + 3 is structurally equivalent to (1 + 2) + 3, but not to 1 +
 * (2 + 3), because the '+' operator is left-replacedociative</li>
 * </ul>
 */
public abstract boolean equalsDeep(SqlNode node, Litmus litmus);

19 View Complete Implementation : Aggregate.java
Copyright Apache License 2.0
Author : apache
public boolean isValid(Litmus litmus, Context context) {
    return super.isValid(litmus, context) && litmus.check(Util.isDistinct(getRowType().getFieldNames()), "distinct field names: {}", getRowType());
}

19 View Complete Implementation : SqlNode.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether two nodes are equal (using
 * {@link #equalsDeep(SqlNode, Litmus)}) or are both null.
 *
 * @param node1 First expression
 * @param node2 Second expression
 * @param litmus What to do if an error is detected (expressions are
 *              not equal)
 */
public static boolean equalDeep(SqlNode node1, SqlNode node2, Litmus litmus) {
    if (node1 == null) {
        return node2 == null;
    } else if (node2 == null) {
        return false;
    } else {
        return node1.equalsDeep(node2, litmus);
    }
}

19 View Complete Implementation : RexChecker.java
Copyright Apache License 2.0
Author : apache
/**
 * Visitor which checks the validity of a {@link RexNode} expression.
 *
 * <p>There are two modes of operation:
 *
 * <ul>
 * <li>Use<code>fail=true</code> to throw an {@link replacedertionError} as soon as
 * an invalid node is detected:
 *
 * <blockquote><code>RexNode node;<br>
 * RelDataType rowType;<br>
 * replacedert new RexChecker(rowType, true).isValid(node);</code></blockquote>
 *
 * This mode requires that replacedertions are enabled.</li>
 *
 * <li>Use <code>fail=false</code> to test for validity without throwing an
 * error.
 *
 * <blockquote><code>RexNode node;<br>
 * RelDataType rowType;<br>
 * RexChecker checker = new RexChecker(rowType, false);<br>
 * node.accept(checker);<br>
 * if (!checker.valid) {<br>
 *    ...<br>
 * }</code></blockquote>
 * </li>
 * </ul>
 *
 * @see RexNode
 */
public clreplaced RexChecker extends RexVisitorImpl<Boolean> {

    // ~ Instance fields --------------------------------------------------------
    protected final RelNode.Context context;

    protected final Litmus litmus;

    protected final List<RelDataType> inputTypeList;

    protected int failCount;

    // ~ Constructors -----------------------------------------------------------
    /**
     * Creates a RexChecker with a given input row type.
     *
     * <p>If <code>fail</code> is true, the checker will throw an
     * {@link replacedertionError} if an invalid node is found and replacedertions are
     * enabled.
     *
     * <p>Otherwise, each method returns whether its part of the tree is valid.
     *
     * @param inputRowType Input row type
     * @param context Context of the enclosing {@link RelNode}, or null
     * @param litmus What to do if an invalid node is detected
     */
    public RexChecker(final RelDataType inputRowType, RelNode.Context context, Litmus litmus) {
        this(RelOptUtil.getFieldTypeList(inputRowType), context, litmus);
    }

    /**
     * Creates a RexChecker with a given set of input fields.
     *
     * <p>If <code>fail</code> is true, the checker will throw an
     * {@link replacedertionError} if an invalid node is found and replacedertions are
     * enabled.
     *
     * <p>Otherwise, each method returns whether its part of the tree is valid.
     *
     * @param inputTypeList Input row type
     * @param context Context of the enclosing {@link RelNode}, or null
     * @param litmus What to do if an error is detected
     */
    public RexChecker(List<RelDataType> inputTypeList, RelNode.Context context, Litmus litmus) {
        super(true);
        this.inputTypeList = inputTypeList;
        this.context = context;
        this.litmus = litmus;
    }

    // ~ Methods ----------------------------------------------------------------
    /**
     * Returns the number of failures encountered.
     *
     * @return Number of failures
     */
    public int getFailureCount() {
        return failCount;
    }

    @Override
    public Boolean visitInputRef(RexInputRef ref) {
        final int index = ref.getIndex();
        if ((index < 0) || (index >= inputTypeList.size())) {
            ++failCount;
            return litmus.fail("RexInputRef index {} out of range 0..{}", index, inputTypeList.size() - 1);
        }
        if (!ref.getType().isStruct() && !RelOptUtil.eq("ref", ref.getType(), "input", inputTypeList.get(index), litmus)) {
            ++failCount;
            return litmus.fail(null);
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitLocalRef(RexLocalRef ref) {
        ++failCount;
        return litmus.fail("RexLocalRef illegal outside program");
    }

    @Override
    public Boolean visitCall(RexCall call) {
        for (RexNode operand : call.getOperands()) {
            Boolean valid = operand.accept(this);
            if (valid != null && !valid) {
                return litmus.fail(null);
            }
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitFieldAccess(RexFieldAccess fieldAccess) {
        super.visitFieldAccess(fieldAccess);
        final RelDataType refType = fieldAccess.getReferenceExpr().getType();
        replacedert refType.isStruct();
        final RelDataTypeField field = fieldAccess.getField();
        final int index = field.getIndex();
        if ((index < 0) || (index > refType.getFieldList().size())) {
            ++failCount;
            return litmus.fail(null);
        }
        final RelDataTypeField typeField = refType.getFieldList().get(index);
        if (!RelOptUtil.eq("type1", typeField.getType(), "type2", fieldAccess.getType(), litmus)) {
            ++failCount;
            return litmus.fail(null);
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitCorrelVariable(RexCorrelVariable v) {
        if (context != null && !context.correlationIds().contains(v.id)) {
            ++failCount;
            return litmus.fail("correlation id {} not found in correlation list {}", v, context.correlationIds());
        }
        return litmus.succeed();
    }

    /**
     * Returns whether an expression is valid.
     */
    public final boolean isValid(RexNode expr) {
        return expr.accept(this);
    }
}

19 View Complete Implementation : SqlOperator.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether the given operands are valid. If not valid and
 * {@code fail}, throws an replacedertion error.
 *
 * <p>Similar to {@link #checkOperandCount}, but some operators may have
 * different valid operands in {@link SqlNode} and {@code RexNode} formats
 * (some examples are CAST and AND), and this method throws internal errors,
 * not user errors.</p>
 */
public boolean validRexOperands(int count, Litmus litmus) {
    return true;
}

19 View Complete Implementation : Filter.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean isValid(Litmus litmus, Context context) {
    if (RexUtil.isNullabilityCast(getCluster().getTypeFactory(), condition)) {
        return litmus.fail("Cast for just nullability not allowed");
    }
    final RexChecker checker = new RexChecker(getInput().getRowType(), context, litmus);
    condition.accept(checker);
    if (checker.getFailureCount() > 0) {
        return litmus.fail(null);
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlRowTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec node, Litmus litmus) {
    if (!(node instanceof SqlRowTypeNameSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlRowTypeNameSpec that = (SqlRowTypeNameSpec) node;
    if (this.fieldNames.size() != that.fieldNames.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < fieldNames.size(); i++) {
        if (!this.fieldNames.get(i).equalsDeep(that.fieldNames.get(i), litmus)) {
            return litmus.fail("{} != {}", this, node);
        }
    }
    if (this.fieldTypes.size() != that.fieldTypes.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < fieldTypes.size(); i++) {
        if (!this.fieldTypes.get(i).equals(that.fieldTypes.get(i))) {
            return litmus.fail("{} != {}", this, node);
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlBasicTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec node, Litmus litmus) {
    if (!(node instanceof SqlBasicTypeNameSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlBasicTypeNameSpec that = (SqlBasicTypeNameSpec) node;
    if (this.sqlTypeName != that.sqlTypeName) {
        return litmus.fail("{} != {}", this, node);
    }
    if (this.precision != that.precision) {
        return litmus.fail("{} != {}", this, node);
    }
    if (this.scale != that.scale) {
        return litmus.fail("{} != {}", this, node);
    }
    if (!Objects.equals(this.charSetName, that.charSetName)) {
        return litmus.fail("{} != {}", this, node);
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlUserDefinedTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus) {
    if (!(spec instanceof SqlUserDefinedTypeNameSpec)) {
        return litmus.fail("{} != {}", this, spec);
    }
    SqlUserDefinedTypeNameSpec that = (SqlUserDefinedTypeNameSpec) spec;
    if (!this.getTypeName().equalsDeep(that.getTypeName(), litmus)) {
        return litmus.fail("{} != {}", this, spec);
    }
    return litmus.succeed();
}

19 View Complete Implementation : LatticeRootNode.java
Copyright Apache License 2.0
Author : apache
/**
 * Validates that nodes form a tree; each node except the first references
 * a predecessor.
 */
boolean isValid(Litmus litmus) {
    for (int i = 0; i < descendants.size(); i++) {
        LatticeNode node = descendants.get(i);
        if (i == 0) {
            if (node != this) {
                return litmus.fail("node 0 should be root");
            }
        } else {
            if (!(node instanceof LatticeChildNode)) {
                return litmus.fail("node after 0 should be child");
            }
            final LatticeChildNode child = (LatticeChildNode) node;
            if (!descendants.subList(0, i).contains(child.parent)) {
                return litmus.fail("parent not in preceding list");
            }
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : DrillCalciteSqlAggFunctionWrapper.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean validRexOperands(int count, Litmus litmus) {
    return true;
}

19 View Complete Implementation : SqlCall.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (node == this) {
        return true;
    }
    if (!(node instanceof SqlCall)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlCall that = (SqlCall) node;
    // Compare operators by name, not idenreplacedy, because they may not
    // have been resolved yet. Use case insensitive comparison since
    // this may be a case insensitive system.
    if (!this.getOperator().getName().equalsIgnoreCase(that.getOperator().getName())) {
        return litmus.fail("{} != {}", this, node);
    }
    return equalDeep(this.getOperandList(), that.getOperandList(), litmus);
}

19 View Complete Implementation : JoinRel.java
Copyright Apache License 2.0
Author : dremio
@Override
public boolean isValid(Litmus litmus, Context context) {
    if (condition != null) {
        if (condition.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) {
            return litmus.fail("condition must be boolean: {}", condition.getType());
        }
        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();
}

19 View Complete Implementation : SqlMapTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus) {
    if (!(spec instanceof SqlMapTypeNameSpec)) {
        return litmus.fail("{} != {}", this, spec);
    }
    SqlMapTypeNameSpec that = (SqlMapTypeNameSpec) spec;
    if (!this.keyType.equalsDeep(that.keyType, litmus)) {
        return litmus.fail("{} != {}", this, spec);
    }
    if (!this.valType.equalsDeep(that.valType, litmus)) {
        return litmus.fail("{} != {}", this, spec);
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlDataTypeSpec.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlDataTypeSpec)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlDataTypeSpec that = (SqlDataTypeSpec) node;
    if (!Objects.equals(this.timeZone, that.timeZone)) {
        return litmus.fail("{} != {}", this, node);
    }
    if (!this.typeNameSpec.equalsDeep(that.typeNameSpec, litmus)) {
        return litmus.fail(null);
    }
    return litmus.succeed();
}

19 View Complete Implementation : RexChecker.java
Copyright Apache License 2.0
Author : lealone
/**
 * Visitor which checks the validity of a {@link RexNode} expression.
 *
 * <p>There are two modes of operation:
 *
 * <ul>
 * <li>Use<code>fail=true</code> to throw an {@link replacedertionError} as soon as
 * an invalid node is detected:
 *
 * <blockquote><code>RexNode node;<br>
 * RelDataType rowType;<br>
 * replacedert new RexChecker(rowType, true).isValid(node);</code></blockquote>
 *
 * This mode requires that replacedertions are enabled.</li>
 *
 * <li>Use <code>fail=false</code> to test for validity without throwing an
 * error.
 *
 * <blockquote><code>RexNode node;<br>
 * RelDataType rowType;<br>
 * RexChecker checker = new RexChecker(rowType, false);<br>
 * node.accept(checker);<br>
 * if (!checker.valid) {<br>
 *    ...<br>
 * }</code></blockquote>
 * </li>
 * </ul>
 *
 * @see RexNode
 */
public clreplaced RexChecker extends RexVisitorImpl<Boolean> {

    // ~ Instance fields --------------------------------------------------------
    protected final RelNode.Context context;

    protected final Litmus litmus;

    protected final List<RelDataType> inputTypeList;

    protected int failCount;

    // ~ Constructors -----------------------------------------------------------
    /**
     * Creates a RexChecker with a given input row type.
     *
     * <p>If <code>fail</code> is true, the checker will throw an
     * {@link replacedertionError} if an invalid node is found and replacedertions are
     * enabled.
     *
     * <p>Otherwise, each method returns whether its part of the tree is valid.
     *
     * @param inputRowType Input row type
     * @param context Context of the enclosing {@link RelNode}, or null
     * @param litmus What to do if an invalid node is detected
     */
    public RexChecker(final RelDataType inputRowType, RelNode.Context context, Litmus litmus) {
        this(RelOptUtil.getFieldTypeList(inputRowType), context, litmus);
    }

    /**
     * Creates a RexChecker with a given set of input fields.
     *
     * <p>If <code>fail</code> is true, the checker will throw an
     * {@link replacedertionError} if an invalid node is found and replacedertions are
     * enabled.
     *
     * <p>Otherwise, each method returns whether its part of the tree is valid.
     *
     * @param inputTypeList Input row type
     * @param context Context of the enclosing {@link RelNode}, or null
     * @param litmus What to do if an error is detected
     */
    public RexChecker(List<RelDataType> inputTypeList, RelNode.Context context, Litmus litmus) {
        super(true);
        this.inputTypeList = inputTypeList;
        this.context = context;
        this.litmus = litmus;
    }

    // ~ Methods ----------------------------------------------------------------
    /**
     * Returns the number of failures encountered.
     *
     * @return Number of failures
     */
    public int getFailureCount() {
        return failCount;
    }

    @Override
    public Boolean visitInputRef(RexInputRef ref) {
        final int index = ref.getIndex();
        if ((index < 0) || (index >= inputTypeList.size())) {
            ++failCount;
            return litmus.fail("RexInputRef index {} out of range 0..{}", index, inputTypeList.size() - 1);
        }
        if (!ref.getType().isStruct() && !RelOptUtil.eq("ref", ref.getType(), "input", inputTypeList.get(index), litmus)) {
            ++failCount;
            return litmus.fail(null);
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitLocalRef(RexLocalRef ref) {
        ++failCount;
        return litmus.fail("RexLocalRef illegal outside program");
    }

    @Override
    public Boolean visitCall(RexCall call) {
        for (RexNode operand : call.getOperands()) {
            Boolean valid = operand.accept(this);
            if (valid != null && !valid) {
                return litmus.fail(null);
            }
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitFieldAccess(RexFieldAccess fieldAccess) {
        super.visitFieldAccess(fieldAccess);
        final RelDataType refType = fieldAccess.getReferenceExpr().getType();
        replacedert refType.isStruct();
        final RelDataTypeField field = fieldAccess.getField();
        final int index = field.getIndex();
        if ((index < 0) || (index > refType.getFieldList().size())) {
            ++failCount;
            return litmus.fail(null);
        }
        final RelDataTypeField typeField = refType.getFieldList().get(index);
        if (!RelOptUtil.eq("type1", typeField.getType(), "type2", fieldAccess.getType(), litmus)) {
            ++failCount;
            return litmus.fail(null);
        }
        return litmus.succeed();
    }

    @Override
    public Boolean visitCorrelVariable(RexCorrelVariable v) {
        if (context != null && !context.correlationIds().contains(v.getCorrelationId())) {
            ++failCount;
            return litmus.fail("correlation id {} not found in correlation list {}", v, context.correlationIds());
        }
        return litmus.succeed();
    }

    /**
     * Returns whether an expression is valid.
     */
    public final boolean isValid(RexNode expr) {
        return expr.accept(this);
    }
}

19 View Complete Implementation : Window.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean isValid(Litmus litmus, Context context) {
    // In the window specifications, an aggregate call such as
    // 'SUM(RexInputRef #10)' refers to expression #10 of inputProgram.
    // (Not its projections.)
    final RelDataType childRowType = getInput().getRowType();
    final int childFieldCount = childRowType.getFieldCount();
    final int inputSize = childFieldCount + constants.size();
    final List<RelDataType> inputTypes = new AbstractList<RelDataType>() {

        @Override
        public RelDataType get(int index) {
            return index < childFieldCount ? childRowType.getFieldList().get(index).getType() : constants.get(index - childFieldCount).getType();
        }

        @Override
        public int size() {
            return inputSize;
        }
    };
    final RexChecker checker = new RexChecker(inputTypes, context, litmus);
    int count = 0;
    for (Group group : groups) {
        for (RexWinAggCall over : group.aggCalls) {
            ++count;
            if (!checker.isValid(over)) {
                return litmus.fail(null);
            }
        }
    }
    if (count == 0) {
        return litmus.fail("empty");
    }
    return litmus.succeed();
}

19 View Complete Implementation : VolcanoRuleMatch.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether all elements of a given array are not-null;
 * fails if any are null.
 */
private static <E> boolean allNotNull(E[] es, Litmus litmus) {
    for (E e : es) {
        if (e == null) {
            return litmus.fail("was null", (Object) es);
        }
    }
    return litmus.succeed();
}

19 View Complete Implementation : AbstractRelNode.java
Copyright Apache License 2.0
Author : apache
public boolean isValid(Litmus litmus, Context context) {
    return litmus.succeed();
}

19 View Complete Implementation : Snapshot.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean isValid(Litmus litmus, Context context) {
    RelDataType dataType = period.getType();
    if (dataType.getSqlTypeName() != SqlTypeName.TIMESTAMP) {
        return litmus.fail("The system time period specification expects Timestamp type but is '" + dataType.getSqlTypeName() + "'");
    }
    return litmus.succeed();
}

19 View Complete Implementation : SqlCollectionTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus) {
    if (!(spec instanceof SqlCollectionTypeNameSpec)) {
        return litmus.fail("{} != {}", this, spec);
    }
    SqlCollectionTypeNameSpec that = (SqlCollectionTypeNameSpec) spec;
    if (!this.elementTypeName.equalsDeep(that.elementTypeName, litmus)) {
        return litmus.fail("{} != {}", this, spec);
    }
    if (!Objects.equals(this.collectionTypeName, that.collectionTypeName)) {
        return litmus.fail("{} != {}", this, spec);
    }
    return litmus.succeed();
}

19 View Complete Implementation : ExtendedSqlCollectionTypeNameSpec.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus) {
    if (!(spec instanceof ExtendedSqlCollectionTypeNameSpec)) {
        return litmus.fail("{} != {}", this, spec);
    }
    ExtendedSqlCollectionTypeNameSpec that = (ExtendedSqlCollectionTypeNameSpec) spec;
    if (this.elementNullable != that.elementNullable) {
        return litmus.fail("{} != {}", this, spec);
    }
    return super.equalsDeep(spec, litmus);
}

18 View Complete Implementation : Lattice.java
Copyright Apache License 2.0
Author : apache
private boolean isValid(Litmus litmus) {
    if (!rootNode.isValid(litmus)) {
        return false;
    }
    for (Measure measure : defaultMeasures) {
        for (Column arg : measure.args) {
            if (columns.get(arg.ordinal) != arg) {
                return litmus.fail("measure argument must be a column registered in" + " this lattice: {}", measure);
            }
        }
    }
    return litmus.succeed();
}

18 View Complete Implementation : RexProgram.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether this program is in canonical form.
 *
 * @param litmus     What to do if an error is detected (program is not in
 *                   canonical form)
 * @param rexBuilder Rex builder
 * @return whether in canonical form
 */
public boolean isNormalized(Litmus litmus, RexBuilder rexBuilder) {
    final RexProgram normalizedProgram = normalize(rexBuilder, null);
    String normalized = normalizedProgram.toString();
    String string = toString();
    if (!normalized.equals(string)) {
        final String message = "Program is not normalized:\n" + "program:    {}\n" + "normalized: {}\n";
        return litmus.fail(message, string, normalized);
    }
    return litmus.succeed();
}

18 View Complete Implementation : SqlIdentifier.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlIdentifier)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlIdentifier that = (SqlIdentifier) node;
    if (this.names.size() != that.names.size()) {
        return litmus.fail("{} != {}", this, node);
    }
    for (int i = 0; i < names.size(); i++) {
        if (!this.names.get(i).equals(that.names.get(i))) {
            return litmus.fail("{} != {}", this, node);
        }
    }
    return litmus.succeed();
}

18 View Complete Implementation : SqlIntervalQualifier.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    final String thisString = this.toString();
    final String thatString = node.toString();
    if (!thisString.equals(thatString)) {
        return litmus.fail("{} != {}", this, node);
    }
    return litmus.succeed();
}

18 View Complete Implementation : SqlLiteral.java
Copyright Apache License 2.0
Author : apache
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    if (!(node instanceof SqlLiteral)) {
        return litmus.fail("{} != {}", this, node);
    }
    SqlLiteral that = (SqlLiteral) node;
    if (!this.equals(that)) {
        return litmus.fail("{} != {}", this, node);
    }
    return litmus.succeed();
}

18 View Complete Implementation : SqlWindow.java
Copyright Apache License 2.0
Author : apache
/**
 * Overridden method to specifically check only the right subtree of a window
 * definition.
 *
 * @param node The SqlWindow to compare to "this" window
 * @param litmus What to do if an error is detected (nodes are not equal)
 *
 * @return boolean true if all nodes in the subtree are equal
 */
@Override
public boolean equalsDeep(SqlNode node, Litmus litmus) {
    // This is the difference over super.equalsDeep.  It skips
    // operands[0] the declared name fo this window.  We only want
    // to check the window components.
    return node == this || node instanceof SqlWindow && SqlNode.equalDeep(Util.skip(getOperandList()), Util.skip(((SqlWindow) node).getOperandList()), litmus);
}

17 View Complete Implementation : RexLiteral.java
Copyright Apache License 2.0
Author : apache
/**
 * Returns whether a value is valid as a constant value, using the same
 * criteria as {@link #valueMatchesType}.
 */
public static boolean validConstant(Object o, Litmus litmus) {
    if (o == null || o instanceof BigDecimal || o instanceof NlsString || o instanceof ByteString || o instanceof Boolean) {
        return litmus.succeed();
    } else if (o instanceof List) {
        List list = (List) o;
        for (Object o1 : list) {
            if (!validConstant(o1, litmus)) {
                return litmus.fail("not a constant: {}", o1);
            }
        }
        return litmus.succeed();
    } else if (o instanceof Map) {
        @SuppressWarnings("unchecked")
        final Map<Object, Object> map = (Map) o;
        for (Map.Entry entry : map.entrySet()) {
            if (!validConstant(entry.getKey(), litmus)) {
                return litmus.fail("not a constant: {}", entry.getKey());
            }
            if (!validConstant(entry.getValue(), litmus)) {
                return litmus.fail("not a constant: {}", entry.getValue());
            }
        }
        return litmus.succeed();
    } else {
        return litmus.fail("not a constant: {}", o);
    }
}

17 View Complete Implementation : RexProgram.java
Copyright Apache License 2.0
Author : apache
/**
 * Checks that this program is valid.
 *
 * <p>If <code>fail</code> is true, executes <code>replacedert false</code>, so
 * will throw an {@link replacedertionError} if replacedertions are enabled. If <code>
 * fail</code> is false, merely returns whether the program is valid.
 *
 * @param litmus What to do if an error is detected
 * @param context Context of enclosing {@link RelNode}, for validity checking,
 *                or null if not known
 * @return Whether the program is valid
 */
public boolean isValid(Litmus litmus, RelNode.Context context) {
    if (inputRowType == null) {
        return litmus.fail(null);
    }
    if (exprs == null) {
        return litmus.fail(null);
    }
    if (projects == null) {
        return litmus.fail(null);
    }
    if (outputRowType == null) {
        return litmus.fail(null);
    }
    // If the input row type is a struct (contains fields) then the leading
    // expressions must be references to those fields. But we don't require
    // this if the input row type is, say, a java clreplaced.
    if (inputRowType.isStruct()) {
        if (!RexUtil.containIdenreplacedy(exprs, inputRowType, litmus)) {
            return litmus.fail(null);
        }
        // None of the other fields should be inputRefs.
        for (int i = inputRowType.getFieldCount(); i < exprs.size(); i++) {
            RexNode expr = exprs.get(i);
            if (expr instanceof RexInputRef) {
                return litmus.fail(null);
            }
        }
    }
    // todo: enable
    // CHECKSTYLE: IGNORE 1
    if (false && RexUtil.containNoCommonExprs(exprs, litmus)) {
        return litmus.fail(null);
    }
    if (!RexUtil.containNoForwardRefs(exprs, inputRowType, litmus)) {
        return litmus.fail(null);
    }
    if (!RexUtil.containNoNonTrivialAggs(exprs, litmus)) {
        return litmus.fail(null);
    }
    final Checker checker = new Checker(inputRowType, RexUtil.types(exprs), null, litmus);
    if (condition != null) {
        if (!SqlTypeUtil.inBooleanFamily(condition.getType())) {
            return litmus.fail("condition must be boolean");
        }
        condition.accept(checker);
        if (checker.failCount > 0) {
            return litmus.fail(null);
        }
    }
    for (RexLocalRef project : projects) {
        project.accept(checker);
        if (checker.failCount > 0) {
            return litmus.fail(null);
        }
    }
    for (RexNode expr : exprs) {
        expr.accept(checker);
        if (checker.failCount > 0) {
            return litmus.fail(null);
        }
    }
    return litmus.succeed();
}

17 View Complete Implementation : SqlDotOperator.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean validRexOperands(final int count, final Litmus litmus) {
    return litmus.fail("DOT is valid only for SqlCall not for RexCall");
}

17 View Complete Implementation : SqlInOperator.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean validRexOperands(int count, Litmus litmus) {
    if (count == 0) {
        return litmus.fail("wrong operand count {} for {}", count, this);
    }
    return litmus.succeed();
}

17 View Complete Implementation : RexLiteralImpl.java
Copyright Apache License 2.0
Author : lealone
/**
 * Returns whether a value is valid as a constant value, using the same
 * criteria as {@link #valueMatchesType}.
 */
public static boolean validConstant(Object o, Litmus litmus) {
    if (o == null || o instanceof BigDecimal || o instanceof NlsString || o instanceof ByteString) {
        return litmus.succeed();
    } else if (o instanceof List) {
        List list = (List) o;
        for (Object o1 : list) {
            if (!validConstant(o1, litmus)) {
                return litmus.fail("not a constant: {}", o1);
            }
        }
        return litmus.succeed();
    } else if (o instanceof Map) {
        @SuppressWarnings("unchecked")
        final Map<Object, Object> map = (Map) o;
        for (Map.Entry entry : map.entrySet()) {
            if (!validConstant(entry.getKey(), litmus)) {
                return litmus.fail("not a constant: {}", entry.getKey());
            }
            if (!validConstant(entry.getValue(), litmus)) {
                return litmus.fail("not a constant: {}", entry.getValue());
            }
        }
        return litmus.succeed();
    } else {
        return litmus.fail("not a constant: {}", o);
    }
}

16 View Complete Implementation : Join.java
Copyright Apache License 2.0
Author : apache
@Override
public boolean isValid(Litmus litmus, Context context) {
    if (!super.isValid(litmus, context)) {
        return false;
    }
    if (getRowType().getFieldCount() != getSystemFieldList().size() + left.getRowType().getFieldCount() + (joinType.projectsRight() ? right.getRowType().getFieldCount() : 0)) {
        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();
}

16 View Complete Implementation : Project.java
Copyright Apache License 2.0
Author : apache
public boolean isValid(Litmus litmus, Context context) {
    if (!super.isValid(litmus, context)) {
        return litmus.fail(null);
    }
    if (!RexUtil.compatibleTypes(exps, getRowType(), litmus)) {
        return litmus.fail("incompatible types");
    }
    RexChecker checker = new RexChecker(getInput().getRowType(), context, litmus);
    for (RexNode exp : exps) {
        exp.accept(checker);
        if (checker.getFailureCount() > 0) {
            return litmus.fail("{} failures in expression {}", checker.getFailureCount(), exp);
        }
    }
    if (!Util.isDistinct(rowType.getFieldNames())) {
        return litmus.fail("field names not distinct: {}", rowType);
    }
    // CHECKSTYLE: IGNORE 1
    if (false && !Util.isDistinct(Lists.transform(exps, RexNode::toString))) {
        // Projecting the same expression twice is usually a bad idea,
        // because it may create expressions downstream which are equivalent
        // but which look different. We can't ban duplicate projects,
        // because we need to allow
        // 
        // SELECT a, b FROM c UNION SELECT x, x FROM z
        return litmus.fail("duplicate expressions: {}", exps);
    }
    return litmus.succeed();
}

16 View Complete Implementation : JoinPrel.java
Copyright Apache License 2.0
Author : apache
/* 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();
}

16 View Complete Implementation : JoinRelBase.java
Copyright Apache License 2.0
Author : dremio
@Override
public boolean isValid(Litmus litmus, Context context) {
    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();
}