After the relational expression has been optimized, a
JavaRelImplementor converts it
into to a plan. If the plan is a Java parse tree, row-expressions are
translated into equivalent Java expressions.
Every row-expression has a type. (Compare with
SqlNode, which is created before validation,
and therefore types may not be available.)
Every node in the parse tree is a
RexLiteralrepresents a boolean, numeric, string, or date constant, or the value
RexVariablerepresents a leaf of the tree. It has sub-types:
RexCorrelVariableis a correlating variable for nested-loop joins
RexInputRefrefers to a field of an input relational expression
RexCallis a call to an operator or function. By means of special operators, we can use this construct to represent virtually every non-leaf node in the tree.
RexRangeRefrefers to a collection of contiguous fields from an input relational expression. It usually exists only during translation.
Expressions are generally
created using a
Interface Summary Interface Description RexActionA
RexActionis called when a
RexPatternfinds a match.
RexBiVisitor<R,P>Visitor pattern for traversing a tree of
RexNodeobjects and passing a payload to each.
RexExecutorCan reduce expressions, writing a literal for each into a list. RexPatternA
RexPatternrepresents an expression with holes in it.
RexSimplify.PredicateMarker interface for predicates (expressions that evaluate to BOOLEAN). RexSqlConvertlet RexSqlConvertletTableCollection of
RexToSqlNodeConverter RexVisitor<R>Visitor pattern for traversing a tree of
Class Summary Class Description LogicVisitorVisitor pattern for traversing a tree of
RexAnalyzerAnalyzes an expression, figures out what are the unbound variables, assigns a variety of values to each unbound variable, and evaluates the expression. RexAnalyzer.VariableCollectorCollects the variables (or other bindable sites) in an expression, and counts features (such as CAST) that
RexBuilderFactory for row expressions. RexCallAn expression formed by a call to an operator with zero or more expressions as operands. RexCallBinding RexCallBinding.RexCastCallBindingTo be compatible with
SqlCall, CAST needs to pretend that it has two arguments, the second of which is the target type.
RexCheckerVisitor which checks the validity of a
RexCopierShuttle which creates a deep copy of a Rex expression. RexCorrelVariableReference to the current row of a correlating relational expression. RexDynamicParamDynamic parameter reference in a row-expression. RexExecutableResult of compiling code generated from a
RexExecutorImpl.DataContextInputGetter RexFieldAccessAccess to a field of a row-expression. RexFieldCollationExpression combined with sort flags (DESCENDING, NULLS LAST). RexFieldCollation.InitializerHelper, used during initialization, that builds a canonizing map from sets of
SqlKindto immutable sets of
RexInputRefVariable which references a field of an input relational expression. RexInterpreterEvaluates
RexLiteralConstant value in a row-expression. RexLocalRefLocal variable. RexMultisetUtilUtility class for various methods related to multisets. RexMultisetUtil.RexCallMultisetOperatorCounterA RexShuttle that traverse all RexNode and counts total number of RexCalls traversed and number of multiset calls traversed. RexNodeRow expression. RexOverCall to an aggregate function over a window. RexOver.Finder RexPatternFieldRefVariable which references a field of an input relational expression RexPermutationShuttle RexPermuteInputsShuttleShuttle which applies a permutation to its input fields. RexProgramA collection of expressions which read inputs, compute output expressions, and optionally use a condition to filter rows. RexProgram.CheckerVisitor which walks over a program and checks validity. RexProgram.ExpansionShuttleA RexShuttle used in the implementation of
RexProgramBuilderWorkspace for constructing a
RexRangeRefReference to a range of columns. RexShuttlePasses over a row-expression, calling a handler method for each node, appropriate to the type of the node. RexSimplifyContext required to simplify a row-expression. RexSimplify.CaseBranchObject to describe a Case branch RexSimplify.Comparison RexSimplify.IsPredicateRepresents an IS Predicate. RexSlot RexSlot.SelfPopulatingListThread-safe list that populates itself if you make a reference beyond the end of the list. RexSqlReflectiveConvertletTableImplementation of
RexSqlStandardConvertletTableStandard implementation of
RexSubQueryScalar expression that represents an IN, EXISTS or scalar sub-query. RexTableInputRefVariable which references a column of a table occurrence in a relational plan. RexTableInputRef.RelTableRefIdentifies uniquely a table by its qualified name and its entity number (occurrence) RexToSqlNodeConverterImplStandard implementation of
RexTransformerTakes a tree of
RexNodeobjects and transforms it into another in one sense equivalent tree.
RexUtilUtility methods concerning row-expressions. RexUtil.CnfHelper RexUtil.ConstantFinderWalks over an expression and determines whether it is constant. RexUtil.CorrelationFinder RexUtil.DnfHelper RexUtil.ExpressionNormalizerWalks over expressions and builds a bank of common sub-expressions. RexUtil.ExprSimplifier Deprecated. RexUtil.FieldAccessFinderVisitor which builds a bitmap of the inputs used by an expression. RexUtil.FixNullabilityShuttleShuttle that fixes up an expression to match changes in nullability of input fields. RexUtil.ForwardRefFinder RexUtil.RexShiftShuttleShuttle that adds
RexInputRefin an expression.
RexUtil.SubQueryFinder RexVariableA row-expression which references a field. RexVisitorImpl<R>Default implementation of
RexVisitor, which visits each node but does nothing while it's there.
RexWindowSpecification of the window of rows over which a
RexOverwindowed aggregate is evaluated.
RexWindowBoundAbstracts "XX PRECEDING/FOLLOWING" and "CURRENT ROW" bounds for windowed aggregates. RexWindowBound.RexWindowBoundBoundedImplements XX PRECEDING/FOLLOWING bound where XX is not UNBOUNDED. RexWindowBound.RexWindowBoundCurrentRowImplements CURRENT ROW bound. RexWindowBound.RexWindowBoundUnboundedImplements UNBOUNDED PRECEDING/FOLLOWING bound.
Enum Summary Enum Description RexInterpreter.TruthyAn enum that wraps boolean and unknown values and makes them comparable. RexSimplify.SafeRexVisitorDecides whether it is safe to flatten the given case part into AND/ORs RexUnknownAsPolicy for whether a simplified expression may instead return another value.
Exception Summary Exception Description RexOver.OverFoundException thrown when an OVER is found. RexUtil.CnfHelper.OverflowErrorException to catch when we pass the limit. RexUtil.ExpressionNormalizer.SubExprExistsExceptionThrown if there is a sub-expression. RexUtil.ForwardRefFinder.IllegalForwardRefExceptionThrown to abort a visit when we find an illegal forward reference.