Package org.apache.calcite.linq4j.tree
Class OptimizeShuttle
java.lang.Object
org.apache.calcite.linq4j.tree.Shuttle
org.apache.calcite.linq4j.tree.OptimizeShuttle
Shuttle that optimizes expressions.
The optimizations are essential, not mere tweaks. Without
optimization, expressions such as false == null
will be left in,
which are invalid to Janino (because it does not automatically box
primitives).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MemberExpression
static final MemberExpression
static final Statement
static final ConstantExpression
static final ConstantExpression
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
isKnownNotNull
(Expression expression) Returns whether an expression always returns a non-null result.visit
(BinaryExpression binary, Expression expression0, Expression expression1) visit
(ConditionalStatement conditionalStatement, List<Node> list) visit
(MethodCallExpression methodCallExpression, @Nullable Expression targetExpression, List<Expression> expressions) visit
(TernaryExpression ternary, Expression expression0, Expression expression1, Expression expression2) visit
(UnaryExpression unaryExpression, Expression expression) Methods inherited from class org.apache.calcite.linq4j.tree.Shuttle
preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Field Details
-
FALSE_EXPR
-
TRUE_EXPR
-
BOXED_FALSE_EXPR
-
BOXED_TRUE_EXPR
-
EMPTY_STATEMENT
-
-
Constructor Details
-
OptimizeShuttle
public OptimizeShuttle()
-
-
Method Details
-
visit
public Expression visit(TernaryExpression ternary, Expression expression0, Expression expression1, Expression expression2) -
visit
-
visit
-
visit
-
visit
public Expression visit(MethodCallExpression methodCallExpression, @Nullable Expression targetExpression, List<Expression> expressions) -
isKnownNotNull
Returns whether an expression always returns a non-null result. For instance, primitive types cannot contain null values.- Parameters:
expression
- expression to test- Returns:
- true when the expression is known to be not-null
-