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
Nested ClassesModifier and TypeClassDescriptionstatic classGroup of windowed aggregate calls that have the same window specification.static classA call to a windowed aggregate function.Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context -
Field Summary
FieldsModifier 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
ConstructorsModifierConstructorDescriptionprotectedWindow(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 RelOptCostcomputeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) Returns the cost of this plan (not including children).abstract Windowcopy(List<RexLiteral> constants) Creates a copy of thisWindow.Describes the inputs and attributes of this relational expression.static RelCollationgetCollation(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 ImmutableIntListgetProjectOrdinals(List<RexNode> exprs) booleanisValid(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, replaceInputMethods 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, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.calcite.rel.hint.Hintable
attachHints, withHintsMethods 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:RelNodeReturns 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
AssertionErrorif it is not valid.- Specified by:
isValidin interfaceRelNode- Overrides:
isValidin classAbstractRelNode- Parameters:
litmus- What to do if invalidcontext- Context for validity checking- Returns:
- Whether relational expression is valid
-
explainTerms
Description copied from class:AbstractRelNodeDescribes 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:
explainTermsin 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:RelNodeReturns 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:
computeSelfCostin interfaceRelNode- Overrides:
computeSelfCostin classAbstractRelNode- Parameters:
planner- Planner for cost calculationmq- Metadata query- Returns:
- Cost of this plan (not including children)
-
getHints
Description copied from interface:HintableReturns the hints of this relational expressions as an immutable list.
-