Class Window
- All Implemented Interfaces:
Cloneable
,RelOptNode
,Hintable
,RelNode
- Direct Known Subclasses:
Bindables.BindableWindow
,EnumerableWindow
,LogicalWindow
A Window can handle several window aggregate functions, over several partitions, with pre- and post-expressions, and an optional post-filter. Each of the partitions is defined by a partition key (zero or more columns) and a range (logical or physical). The partitions expect the data to be sorted correctly on input to the relational expression.
Each Window.Group
has a set of
RexOver
objects.
Created by ProjectToWindowRule
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Group of windowed aggregate calls that have the same window specification.static class
A call to a windowed aggregate function.Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
Field Summary
Modifier and TypeFieldDescriptionfinal com.google.common.collect.ImmutableList<RexLiteral>
final com.google.common.collect.ImmutableList<Window.Group>
protected final com.google.common.collect.ImmutableList<RelHint>
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Constructor Summary
ModifierConstructorDescriptionprotected
Window
(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode input, List<RexLiteral> constants, RelDataType rowType, List<Window.Group> groups) Creates a window relational expression.Window
(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, List<RexLiteral> constants, RelDataType rowType, List<Window.Group> groups) Creates a window relational expression. -
Method Summary
Modifier and TypeMethodDescription@Nullable RelOptCost
computeSelfCost
(RelOptPlanner planner, RelMetadataQuery mq) Returns the cost of this plan (not including children).abstract Window
copy
(List<RexLiteral> constants) Creates a copy of thisWindow
.Describes the inputs and attributes of this relational expression.static RelCollation
getCollation
(List<RexFieldCollation> collations) Returns constants that are additional inputs of current relation.com.google.common.collect.ImmutableList<RelHint>
getHints()
Returns the hints of this relational expressions as an immutable list.static ImmutableIntList
getProjectOrdinals
(List<RexNode> exprs) boolean
isValid
(Litmus litmus, @Nullable RelNode.Context context) Returns whether this relational expression is valid.Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, collectVariablesSet, collectVariablesUsed, copy, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isEnforcer, metadata, onRegister, recomputeDigest, register, sole, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.hint.Hintable
attachHints, withHints
Methods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable, stripped
-
Field Details
-
groups
-
constants
-
hints
-
-
Constructor Details
-
Window
protected Window(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode input, List<RexLiteral> constants, RelDataType rowType, List<Window.Group> groups) Creates a window relational expression.- Parameters:
cluster
- ClustertraitSet
- Trait sethints
- Hints for this nodeinput
- Input relational expressionconstants
- List of constants that are additional inputsrowType
- Output row typegroups
- Windows
-
Window
public Window(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, List<RexLiteral> constants, RelDataType rowType, List<Window.Group> groups) Creates a window relational expression.- Parameters:
cluster
- ClustertraitSet
- Trait setinput
- Input relational expressionconstants
- List of constants that are additional inputsrowType
- Output row typegroups
- Windows
-
-
Method Details
-
copy
Creates a copy of thisWindow
.- Parameters:
constants
- Replaces the list of constants in the returned copy- Returns:
- New
Window
-
isValid
Description copied from interface:RelNode
Returns whether this relational expression is valid.If assertions are enabled, this method is typically called with
litmus
=THROW
, as follows:assert rel.isValid(Litmus.THROW)
This signals that the method can throw an
AssertionError
if it is not valid.- Specified by:
isValid
in interfaceRelNode
- Overrides:
isValid
in classAbstractRelNode
- Parameters:
litmus
- What to do if invalidcontext
- Context for validity checking- Returns:
- Whether relational expression is valid
-
explainTerms
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriter.input(String, RelNode)
andRelWriter.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classSingleRel
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
getProjectOrdinals
-
getCollation
-
getConstants
Returns constants that are additional inputs of current relation.- Returns:
- constants that are additional inputs of current relation
-
computeSelfCost
Description copied from interface:RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.apache.calcite.rel.RelNode)
, which gives plugins a chance to override the rel's default ideas about cost.- Specified by:
computeSelfCost
in interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
getHints
Description copied from interface:Hintable
Returns the hints of this relational expressions as an immutable list.
-