Package org.apache.calcite.rex
Class RexShuttle
- java.lang.Object
-
- org.apache.calcite.rex.RexShuttle
-
- All Implemented Interfaces:
RexVisitor<RexNode>
- Direct Known Subclasses:
CalcRelSplitter.InputToCommonExprConverter
,CorrelationReferenceFinder.MyRexVisitor
,DateRangeRules.ExtractShuttle
,DeduplicateCorrelateVariables.DeduplicateCorrelateVariablesShuttle
,FilterRemoveIsNotDistinctFromRule.RemoveIsNotDistinctFromRexShuttle
,PredicateAnalyzer.NotLikeConverter
,ProjectCorrelateTransposeRule.RexFieldAccessReplacer
,ReduceDecimalsRule.DecimalShuttle
,ReduceExpressionsRule.CaseShuttle
,ReduceExpressionsRule.RexReplacer
,RelBuilder.Shifter
,RelDecorrelator.DecorrelateRexShuttle
,RelDecorrelator.RemoveCorrelationRexShuttle
,RelMdExpressionLineage.RexReplacer
,RelOptUtil.InputReferencedVisitor
,RelOptUtil.RexInputConverter
,RelOptUtil.VariableUsedVisitor
,RelStructuredTypeFlattener.RewriteRexShuttle
,RexCopier
,RexPermutationShuttle
,RexPermuteInputsShuttle
,RexProgram.ExpansionShuttle
,RexProgramBuilder.RegisterShuttle
,RexProgramBuilder.UpdateRefShuttle
,RexUtil.ExprSimplifier
,RexUtil.FixNullabilityShuttle
,RexUtil.RexShiftShuttle
,SqlToRelConverter.HistogramShuttle
,SubQueryRemoveRule.ReplaceSubQueryShuttle
,ValuesReduceRule.MyRexShuttle
public class RexShuttle extends java.lang.Object implements RexVisitor<RexNode>
Passes over a row-expression, calling a handler method for each node, appropriate to the type of the node.Like
RexVisitor
, this is an instance of theVisitor Pattern
. UseRexShuttle
if you would like your methods to return a value.
-
-
Constructor Summary
Constructors Constructor Description RexShuttle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<RexNode>
apply(java.lang.Iterable<? extends RexNode> iterable)
Applies this shuttle to each expression in an iterable.<T extends RexNode>
java.util.List<T>apply(java.util.List<T> exprList)
Applies this shuttle to each expression in a list and returns the resulting list.RexNode
apply(RexNode expr)
Applies this shuttle to an expression, or returns null if the expression is null.<T extends RexNode>
booleanmutate(java.util.List<T> exprList)
Applies this shuttle to each expression in a list.protected RexNode[]
visitArray(RexNode[] exprs, boolean[] update)
Visits each of an array of expressions and returns an array of the results.RexNode
visitCall(RexCall call)
RexNode
visitCorrelVariable(RexCorrelVariable variable)
RexNode
visitDynamicParam(RexDynamicParam dynamicParam)
RexNode
visitFieldAccess(RexFieldAccess fieldAccess)
protected java.util.List<RexFieldCollation>
visitFieldCollations(java.util.List<RexFieldCollation> collations, boolean[] update)
Visits each of a list of field collations and returns a list of the results.RexNode
visitInputRef(RexInputRef inputRef)
protected java.util.List<RexNode>
visitList(java.util.List<? extends RexNode> exprs, boolean[] update)
Visits each of a list of expressions and returns a list of the results.void
visitList(java.util.List<? extends RexNode> exprs, java.util.List<RexNode> outExprs)
Visits a list and writes the results to another list.RexNode
visitLiteral(RexLiteral literal)
RexNode
visitLocalRef(RexLocalRef localRef)
RexNode
visitOver(RexOver over)
RexNode
visitPatternFieldRef(RexPatternFieldRef fieldRef)
RexNode
visitRangeRef(RexRangeRef rangeRef)
RexNode
visitSubQuery(RexSubQuery subQuery)
RexNode
visitTableInputRef(RexTableInputRef ref)
RexWindow
visitWindow(RexWindow window)
-
-
-
Method Detail
-
visitOver
public RexNode visitOver(RexOver over)
- Specified by:
visitOver
in interfaceRexVisitor<RexNode>
-
visitSubQuery
public RexNode visitSubQuery(RexSubQuery subQuery)
- Specified by:
visitSubQuery
in interfaceRexVisitor<RexNode>
-
visitTableInputRef
public RexNode visitTableInputRef(RexTableInputRef ref)
- Specified by:
visitTableInputRef
in interfaceRexVisitor<RexNode>
-
visitPatternFieldRef
public RexNode visitPatternFieldRef(RexPatternFieldRef fieldRef)
- Specified by:
visitPatternFieldRef
in interfaceRexVisitor<RexNode>
-
visitCall
public RexNode visitCall(RexCall call)
- Specified by:
visitCall
in interfaceRexVisitor<RexNode>
-
visitArray
protected RexNode[] visitArray(RexNode[] exprs, boolean[] update)
Visits each of an array of expressions and returns an array of the results.- Parameters:
exprs
- Array of expressionsupdate
- If not null, sets this to true if any of the expressions was modified- Returns:
- Array of visited expressions
-
visitList
protected java.util.List<RexNode> visitList(java.util.List<? extends RexNode> exprs, boolean[] update)
Visits each of a list of expressions and returns a list of the results.- Parameters:
exprs
- List of expressionsupdate
- If not null, sets this to true if any of the expressions was modified- Returns:
- Array of visited expressions
-
visitList
public void visitList(java.util.List<? extends RexNode> exprs, java.util.List<RexNode> outExprs)
Visits a list and writes the results to another list.
-
visitFieldCollations
protected java.util.List<RexFieldCollation> visitFieldCollations(java.util.List<RexFieldCollation> collations, boolean[] update)
Visits each of a list of field collations and returns a list of the results.- Parameters:
collations
- List of field collationsupdate
- If not null, sets this to true if any of the expressions was modified- Returns:
- Array of visited field collations
-
visitCorrelVariable
public RexNode visitCorrelVariable(RexCorrelVariable variable)
- Specified by:
visitCorrelVariable
in interfaceRexVisitor<RexNode>
-
visitFieldAccess
public RexNode visitFieldAccess(RexFieldAccess fieldAccess)
- Specified by:
visitFieldAccess
in interfaceRexVisitor<RexNode>
-
visitInputRef
public RexNode visitInputRef(RexInputRef inputRef)
- Specified by:
visitInputRef
in interfaceRexVisitor<RexNode>
-
visitLocalRef
public RexNode visitLocalRef(RexLocalRef localRef)
- Specified by:
visitLocalRef
in interfaceRexVisitor<RexNode>
-
visitLiteral
public RexNode visitLiteral(RexLiteral literal)
- Specified by:
visitLiteral
in interfaceRexVisitor<RexNode>
-
visitDynamicParam
public RexNode visitDynamicParam(RexDynamicParam dynamicParam)
- Specified by:
visitDynamicParam
in interfaceRexVisitor<RexNode>
-
visitRangeRef
public RexNode visitRangeRef(RexRangeRef rangeRef)
- Specified by:
visitRangeRef
in interfaceRexVisitor<RexNode>
-
mutate
public final <T extends RexNode> boolean mutate(java.util.List<T> exprList)
Applies this shuttle to each expression in a list.- Returns:
- whether any of the expressions changed
-
apply
public final <T extends RexNode> java.util.List<T> apply(java.util.List<T> exprList)
Applies this shuttle to each expression in a list and returns the resulting list. Does not modify the initial list.
-
apply
public final java.lang.Iterable<RexNode> apply(java.lang.Iterable<? extends RexNode> iterable)
Applies this shuttle to each expression in an iterable.
-
-