Class Window
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.rel.SingleRel
-
- org.apache.calcite.rel.core.Window
-
- All Implemented Interfaces:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
Bindables.BindableWindow
,EnumerableWindow
,LogicalWindow
public abstract class Window extends SingleRel
A relational expression representing a set of window aggregates.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 ofRexOver
objects.Created by
ProjectToWindowRule
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Window.Group
Group of windowed aggregate calls that have the same window specification.static class
Window.RexWinAggCall
A call to a windowed aggregate function.-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description com.google.common.collect.ImmutableList<RexLiteral>
constants
com.google.common.collect.ImmutableList<Window.Group>
groups
-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Constructor Description Window(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, java.util.List<RexLiteral> constants, RelDataType rowType, java.util.List<Window.Group> groups)
Creates a window relational expression.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RelOptCost
computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Returns the cost of this plan (not including children).RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.static RelCollation
getCollation(java.util.List<RexFieldCollation> collations)
java.util.List<RexLiteral>
getConstants()
Returns constants that are additional inputs of current relation.static ImmutableIntList
getProjectOrdinals(java.util.List<RexNode> exprs)
boolean
isValid(Litmus litmus, 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, computeDigest, computeSelfCost, copy, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
-
-
-
-
Field Detail
-
groups
public final com.google.common.collect.ImmutableList<Window.Group> groups
-
constants
public final com.google.common.collect.ImmutableList<RexLiteral> constants
-
-
Constructor Detail
-
Window
public Window(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, java.util.List<RexLiteral> constants, RelDataType rowType, java.util.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 Detail
-
isValid
public boolean isValid(Litmus litmus, RelNode.Context context)
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
public RelWriter explainTerms(RelWriter pw)
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.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
public static ImmutableIntList getProjectOrdinals(java.util.List<RexNode> exprs)
-
getCollation
public static RelCollation getCollation(java.util.List<RexFieldCollation> collations)
-
getConstants
public java.util.List<RexLiteral> getConstants()
Returns constants that are additional inputs of current relation.- Returns:
- constants that are additional inputs of current relation
-
computeSelfCost
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
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)
-
-