public abstract class Window extends SingleRel
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
.
Modifier and Type | Class and 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.
|
RelNode.Context
Modifier and Type | Field and Description |
---|---|
com.google.common.collect.ImmutableList<RexLiteral> |
constants |
com.google.common.collect.ImmutableList<Window.Group> |
groups |
digest, id, rowType, traitSet
Constructor and 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.
|
Modifier and Type | Method and 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.
|
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
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
public final com.google.common.collect.ImmutableList<Window.Group> groups
public final com.google.common.collect.ImmutableList<RexLiteral> constants
public Window(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, java.util.List<RexLiteral> constants, RelDataType rowType, java.util.List<Window.Group> groups)
cluster
- ClustertraitSet
- Trait setinput
- Input relational expressionconstants
- List of constants that are additional inputsrowType
- Output row typegroups
- Windowspublic boolean isValid(Litmus litmus, RelNode.Context context)
RelNode
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.
isValid
in interface RelNode
isValid
in class AbstractRelNode
litmus
- What to do if invalidcontext
- Context for validity checkingpublic RelWriter explainTerms(RelWriter pw)
AbstractRelNode
super.explainTerms
, then call the
RelWriter.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms
in class SingleRel
pw
- Plan writerpublic static ImmutableIntList getProjectOrdinals(java.util.List<RexNode> exprs)
public static RelCollation getCollation(java.util.List<RexFieldCollation> collations)
public java.util.List<RexLiteral> getConstants()
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNode
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.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
planner
- Planner for cost calculationmq
- Metadata queryCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.