Package org.apache.calcite.rex
Class RexOver
- java.lang.Object
-
- org.apache.calcite.rex.RexNode
-
- org.apache.calcite.rex.RexCall
-
- org.apache.calcite.rex.RexOver
-
public class RexOver extends RexCall
Call to an aggregate function over a window.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RexOver.Finder
private static class
RexOver.OverFound
Exception thrown when an OVER is found.
-
Constructor Summary
Constructors Constructor Description RexOver(RelDataType type, SqlAggFunction op, java.util.List<RexNode> operands, RexWindow window, boolean distinct)
Creates a RexOver.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,P>
Raccept(RexBiVisitor<R,P> visitor, P arg)
Accepts a visitor with a payload, dispatching to the right overloadedRexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method.<R> R
accept(RexVisitor<R> visitor)
Accepts a visitor, dispatching to the right overloadedvisitXxx
method.RexCall
clone(RelDataType type, java.util.List<RexNode> operands)
Creates a new call to the same operator with different operands.protected java.lang.String
computeDigest(boolean withType)
static boolean
containsOver(java.util.List<RexNode> exprs, RexNode condition)
Returns whether an expression list contains an OVER clause.static boolean
containsOver(RexNode expr)
Returns whether an expression contains an OVER clause.static boolean
containsOver(RexProgram program)
Returns whether a program contains an OVER clause.SqlAggFunction
getAggOperator()
Returns the aggregate operator for this expression.RexWindow
getWindow()
boolean
isDistinct()
-
Methods inherited from class org.apache.calcite.rex.RexCall
equals, getKind, getOperands, getOperator, getType, hashCode, isAlwaysFalse, isAlwaysTrue, toString
-
-
-
-
Field Detail
-
FINDER
private static final RexOver.Finder FINDER
-
window
private final RexWindow window
-
distinct
private final boolean distinct
-
-
Constructor Detail
-
RexOver
RexOver(RelDataType type, SqlAggFunction op, java.util.List<RexNode> operands, RexWindow window, boolean distinct)
Creates a RexOver.For example, "SUM(DISTINCT x) OVER (ROWS 3 PRECEDING)" is represented as:
- type = Integer,
- op =
SqlStdOperatorTable.SUM
, - operands = {
RexFieldAccess
("x") } - window =
SqlWindow
(ROWS 3 PRECEDING)
- Parameters:
type
- Result typeop
- Aggregate operatoroperands
- Operands listwindow
- Window specificationdistinct
- Aggregate operator is applied on distinct elements
-
-
Method Detail
-
getAggOperator
public SqlAggFunction getAggOperator()
Returns the aggregate operator for this expression.
-
getWindow
public RexWindow getWindow()
-
isDistinct
public boolean isDistinct()
-
computeDigest
@Nonnull protected java.lang.String computeDigest(boolean withType)
- Overrides:
computeDigest
in classRexCall
-
accept
public <R> R accept(RexVisitor<R> visitor)
Description copied from class:RexNode
Accepts a visitor, dispatching to the right overloadedvisitXxx
method.Also see
RexUtil.apply(RexVisitor, java.util.List, RexNode)
, which applies a visitor to several expressions simultaneously.
-
accept
public <R,P> R accept(RexBiVisitor<R,P> visitor, P arg)
Description copied from class:RexNode
Accepts a visitor with a payload, dispatching to the right overloadedRexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method.
-
containsOver
public static boolean containsOver(RexNode expr)
Returns whether an expression contains an OVER clause.
-
containsOver
public static boolean containsOver(RexProgram program)
Returns whether a program contains an OVER clause.
-
containsOver
public static boolean containsOver(java.util.List<RexNode> exprs, RexNode condition)
Returns whether an expression list contains an OVER clause.
-
-