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 boolean |
fail |
protected int |
failCount |
protected List<RelDataType> |
inputTypeList |
deep| Constructor and Description |
|---|
RexChecker(List<RelDataType> inputTypeList,
boolean fail)
Creates a RexChecker with a given set of input fields.
|
RexChecker(RelDataType inputRowType,
boolean fail)
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 |
visitFieldAccess(RexFieldAccess fieldAccess) |
Boolean |
visitInputRef(RexInputRef ref) |
Boolean |
visitLocalRef(RexLocalRef ref) |
visitArrayAnd, visitArrayOr, visitCorrelVariable, visitDynamicParam, visitLiteral, visitOver, visitRangeRefprotected final boolean fail
protected final List<RelDataType> inputTypeList
protected int failCount
public RexChecker(RelDataType inputRowType, boolean fail)
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 typefail - Whether to throw an AssertionError if an
invalid node is detectedpublic RexChecker(List<RelDataType> inputTypeList, boolean fail)
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 typefail - Whether to throw an AssertionError if an
invalid node 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 final boolean isValid(RexNode expr)
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.