public class RexChecker extends RexVisitorImpl<Boolean>
RexNode expression.
There are two modes of operation:
fail=true to throw an AssertionError as soon as
an invalid node is detected:
RexNode node;
RelDataType rowType;
assert new RexChecker(rowType, true).isValid(node);
This mode requires that assertions are enabled.fail=false to test for validity without throwing an
error.
RexNode node;
RelDataType rowType;
RexChecker checker = new RexChecker(rowType, false);
node.accept(checker);
if (!checker.valid) {
...
}
RexNode| Modifier and Type | Field and Description |
|---|---|
protected RelNode.Context |
context |
protected int |
failCount |
protected List<RelDataType> |
inputTypeList |
protected Litmus |
litmus |
deep| Constructor and Description |
|---|
RexChecker(List<RelDataType> inputTypeList,
RelNode.Context context,
Litmus litmus)
Creates a RexChecker with a given set of input fields.
|
RexChecker(RelDataType inputRowType,
RelNode.Context context,
Litmus litmus)
Creates a RexChecker with a given input row type.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getFailureCount()
Returns the number of failures encountered.
|
boolean |
isValid(RexNode expr)
Returns whether an expression is valid.
|
Boolean |
visitCall(RexCall call) |
Boolean |
visitCorrelVariable(RexCorrelVariable v) |
Boolean |
visitFieldAccess(RexFieldAccess fieldAccess) |
Boolean |
visitInputRef(RexInputRef ref) |
Boolean |
visitLocalRef(RexLocalRef ref) |
visitArrayAnd, visitArrayOr, visitDynamicParam, visitLiteral, visitOver, visitPatternFieldRef, visitRangeRef, visitSubQuery, visitTableInputRefclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitEach, visitList, visitListprotected final RelNode.Context context
protected final Litmus litmus
protected final List<RelDataType> inputTypeList
protected int failCount
public RexChecker(RelDataType inputRowType, RelNode.Context context, Litmus litmus)
If fail is true, the checker will throw an
AssertionError if an invalid node is found and assertions are
enabled.
Otherwise, each method returns whether its part of the tree is valid.
inputRowType - Input row typecontext - Context of the enclosing RelNode, or nulllitmus - What to do if an invalid node is detectedpublic RexChecker(List<RelDataType> inputTypeList, RelNode.Context context, Litmus litmus)
If fail is true, the checker will throw an
AssertionError if an invalid node is found and assertions are
enabled.
Otherwise, each method returns whether its part of the tree is valid.
inputTypeList - Input row typecontext - Context of the enclosing RelNode, or nulllitmus - What to do if an error is detectedpublic int getFailureCount()
public Boolean visitInputRef(RexInputRef ref)
visitInputRef in interface RexVisitor<Boolean>visitInputRef in class RexVisitorImpl<Boolean>public Boolean visitLocalRef(RexLocalRef ref)
visitLocalRef in interface RexVisitor<Boolean>visitLocalRef in class RexVisitorImpl<Boolean>public Boolean visitCall(RexCall call)
visitCall in interface RexVisitor<Boolean>visitCall in class RexVisitorImpl<Boolean>public Boolean visitFieldAccess(RexFieldAccess fieldAccess)
visitFieldAccess in interface RexVisitor<Boolean>visitFieldAccess in class RexVisitorImpl<Boolean>public Boolean visitCorrelVariable(RexCorrelVariable v)
visitCorrelVariable in interface RexVisitor<Boolean>visitCorrelVariable in class RexVisitorImpl<Boolean>public final boolean isValid(RexNode expr)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.