Package org.apache.iceberg.expressions
Class ExpressionVisitors
- java.lang.Object
-
- org.apache.iceberg.expressions.ExpressionVisitors
-
public class ExpressionVisitors extends java.lang.Object
Utils for traversingexpressions
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExpressionVisitors.BoundExpressionVisitor<R>
static class
ExpressionVisitors.BoundVisitor<R>
static class
ExpressionVisitors.CustomOrderExpressionVisitor<R>
static class
ExpressionVisitors.ExpressionVisitor<R>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R> R
visit(Expression expr, ExpressionVisitors.CustomOrderExpressionVisitor<R> visitor)
Traverses the givenexpression
with avisitor
.static <R> R
visit(Expression expr, ExpressionVisitors.ExpressionVisitor<R> visitor)
Traverses the givenexpression
with avisitor
.static java.lang.Boolean
visitEvaluator(Expression expr, ExpressionVisitors.ExpressionVisitor<java.lang.Boolean> visitor)
Traverses the givenexpression
with avisitor
.
-
-
-
Method Detail
-
visit
public static <R> R visit(Expression expr, ExpressionVisitors.ExpressionVisitor<R> visitor)
Traverses the givenexpression
with avisitor
.The visitor will be called to handle each node in the expression tree in postfix order. Result values produced by child nodes are passed when parent nodes are handled.
- Type Parameters:
R
- the return type produced by the expression visitor- Parameters:
expr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression tree- Returns:
- the value returned by the visitor for the root expression node
-
visitEvaluator
public static java.lang.Boolean visitEvaluator(Expression expr, ExpressionVisitors.ExpressionVisitor<java.lang.Boolean> visitor)
Traverses the givenexpression
with avisitor
.The visitor will be called to handle only nodes required for determining result in the expression tree in postfix order. Result values produced by child nodes are passed when parent nodes are handled.
- Parameters:
expr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression tree- Returns:
- the value returned by the visitor for the root expression node
-
visit
public static <R> R visit(Expression expr, ExpressionVisitors.CustomOrderExpressionVisitor<R> visitor)
Traverses the givenexpression
with avisitor
.This passes a
Supplier
to each non-leafvisitor
method. The supplier returns the result of traversing child expressions. Getting the result of the supplier allows traversing the expression in the desired order.- Type Parameters:
R
- the return type produced by the expression visitor- Parameters:
expr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression tree- Returns:
- the value returned by the visitor for the root expression node
-
-