Package org.apache.calcite.rex
Class RexWindowBound
- java.lang.Object
-
- org.apache.calcite.rex.RexWindowBound
-
- Direct Known Subclasses:
RexWindowBound.RexWindowBoundBounded
,RexWindowBound.RexWindowBoundCurrentRow
,RexWindowBound.RexWindowBoundUnbounded
public abstract class RexWindowBound extends java.lang.Object
Abstracts "XX PRECEDING/FOLLOWING" and "CURRENT ROW" bounds for windowed aggregates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RexWindowBound.RexWindowBoundBounded
Implements XX PRECEDING/FOLLOWING bound where XX is not UNBOUNDED.private static class
RexWindowBound.RexWindowBoundCurrentRow
Implements CURRENT ROW bound.private static class
RexWindowBound.RexWindowBoundUnbounded
Implements UNBOUNDED PRECEDING/FOLLOWING bound.
-
Constructor Summary
Constructors Constructor Description RexWindowBound()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> RexWindowBound
accept(RexVisitor<R> visitor)
Transforms the bound viaRexVisitor
.static RexWindowBound
create(SqlNode node, RexNode rexNode)
Creates window bound.RexNode
getOffset()
Returns offset from XX PRECEDING/FOLLOWING.int
getOrderKey()
Returns relative sort offset when known at compile time.boolean
isCurrentRow()
Returns if the bound is CURRENT ROW.boolean
isFollowing()
Returns if the bound is FOLLOWING.boolean
isPreceding()
Returns if the bound is PRECEDING.boolean
isUnbounded()
Returns if the bound is unbounded.
-
-
-
Method Detail
-
create
public static RexWindowBound create(SqlNode node, RexNode rexNode)
Creates window bound.- Parameters:
node
- SqlNode of the boundrexNode
- offset value when bound is not UNBOUNDED/CURRENT ROW- Returns:
- window bound
-
isUnbounded
public boolean isUnbounded()
Returns if the bound is unbounded.- Returns:
- if the bound is unbounded
-
isPreceding
public boolean isPreceding()
Returns if the bound is PRECEDING.- Returns:
- if the bound is PRECEDING
-
isFollowing
public boolean isFollowing()
Returns if the bound is FOLLOWING.- Returns:
- if the bound is FOLLOWING
-
isCurrentRow
public boolean isCurrentRow()
Returns if the bound is CURRENT ROW.- Returns:
- if the bound is CURRENT ROW
-
getOffset
public RexNode getOffset()
Returns offset from XX PRECEDING/FOLLOWING.- Returns:
- offset from XX PRECEDING/FOLLOWING
-
getOrderKey
public int getOrderKey()
Returns relative sort offset when known at compile time. For instance, UNBOUNDED PRECEDING is less than CURRENT ROW.- Returns:
- relative order or -1 when order is not known
-
accept
public <R> RexWindowBound accept(RexVisitor<R> visitor)
Transforms the bound viaRexVisitor
.- Type Parameters:
R
- return type of the visitor- Parameters:
visitor
- visitor to accept- Returns:
- transformed bound
-
-