Package org.apache.calcite.rel.core
Class Window.Group
- java.lang.Object
-
- org.apache.calcite.rel.core.Window.Group
-
- Enclosing class:
- Window
public static class Window.Group extends java.lang.Object
Group of windowed aggregate calls that have the same window specification.The specification is defined by an upper and lower bound, and also has zero or more partitioning columns.
A window is either logical or physical. A physical window is measured in terms of row count. A logical window is measured in terms of rows within a certain distance from the current sort key.
For example:
ROWS BETWEEN 10 PRECEDING and 5 FOLLOWING
is a physical window with an upper and lower bound;RANGE BETWEEN INTERVAL '1' HOUR PRECEDING AND UNBOUNDED FOLLOWING
is a logical window with only a lower bound;RANGE INTERVAL '10' MINUTES PRECEDING
(which is equivalent toRANGE BETWEEN INTERVAL '10' MINUTES PRECEDING AND CURRENT ROW
) is a logical window with an upper and lower bound.
-
-
Field Summary
Fields Modifier and Type Field Description com.google.common.collect.ImmutableList<Window.RexWinAggCall>
aggCalls
List ofWindow.RexWinAggCall
objects, each of which is a call to aSqlAggFunction
.private java.lang.String
digest
boolean
isRows
ImmutableBitSet
keys
RexWindowBound
lowerBound
RelCollation
orderKeys
RexWindowBound
upperBound
-
Constructor Summary
Constructors Constructor Description Group(ImmutableBitSet keys, boolean isRows, RexWindowBound lowerBound, RexWindowBound upperBound, RelCollation orderKeys, java.util.List<Window.RexWinAggCall> aggCalls)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RelCollation
collation()
private java.lang.String
computeString()
boolean
equals(java.lang.Object obj)
java.util.List<AggregateCall>
getAggregateCalls(Window windowRel)
Presents a view of theWindow.RexWinAggCall
list as a list ofAggregateCall
.int
hashCode()
boolean
isAlwaysNonEmpty()
Returns if the window is guaranteed to have rows.java.lang.String
toString()
-
-
-
Field Detail
-
keys
public final ImmutableBitSet keys
-
isRows
public final boolean isRows
-
lowerBound
public final RexWindowBound lowerBound
-
upperBound
public final RexWindowBound upperBound
-
orderKeys
public final RelCollation orderKeys
-
digest
private final java.lang.String digest
-
aggCalls
public final com.google.common.collect.ImmutableList<Window.RexWinAggCall> aggCalls
List ofWindow.RexWinAggCall
objects, each of which is a call to aSqlAggFunction
.
-
-
Constructor Detail
-
Group
public Group(ImmutableBitSet keys, boolean isRows, RexWindowBound lowerBound, RexWindowBound upperBound, RelCollation orderKeys, java.util.List<Window.RexWinAggCall> aggCalls)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
computeString
private java.lang.String computeString()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
collation
public RelCollation collation()
-
isAlwaysNonEmpty
public boolean isAlwaysNonEmpty()
Returns if the window is guaranteed to have rows. This is useful to refine data type of window aggregates. For instance sum(non-nullable) over (empty window) is NULL.- Returns:
- true when the window is non-empty
- See Also:
SqlWindow.isAlwaysNonEmpty()
,SqlOperatorBinding.getGroupCount()
,SqlValidatorImpl.resolveWindow(org.apache.calcite.sql.SqlNode, org.apache.calcite.sql.validate.SqlValidatorScope, boolean)
-
getAggregateCalls
public java.util.List<AggregateCall> getAggregateCalls(Window windowRel)
Presents a view of theWindow.RexWinAggCall
list as a list ofAggregateCall
.
-
-