Class RexChecker

java.lang.Object
org.apache.calcite.rex.RexVisitorImpl<@Nullable Boolean>
org.apache.calcite.rex.RexChecker
All Implemented Interfaces:
RexVisitor<Boolean>

public class RexChecker extends RexVisitorImpl<@Nullable Boolean>
Visitor which checks the validity of a RexNode expression.

This visitor can operate in two modes, controlled by the Litmus argument:

  • Litmus.THROW causes the checker to throw an AssertionError as soon as an invalid node is detected. Note: This mode requires that assertions are enabled.
     // Example usage of Litmus.THROW
     RexNode node;
     RelDataType rowType;
     RexChecker checker = new RexChecker(rowType, Litmus.THROW);
     node.accept(checker); // Will throw an AssertionError if node is invalid
     
  • Litmus.IGNORE tests validity without throwing an error.
     // Example usage of Litmus.IGNORE
     RexNode node;
     RelDataType rowType;
     RexChecker checker = new RexChecker(rowType, Litmus.IGNORE);
     node.accept(checker);
     if (!checker.isValid()) {
         // Handle invalid node
     }
     
See Also: