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,
List<RexLiteral> constants,
RelDataType rowType,
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(List<RexFieldCollation> collations) |
List<RexLiteral> |
getConstants()
Returns constants that are additional inputs of current relation.
|
static ImmutableIntList |
getProjectOrdinals(List<RexNode> exprs) |
boolean |
isValid(Litmus litmus,
RelNode.Context context)
Returns whether this relational expression is valid.
|
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInputaccept, 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, toStringpublic 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, List<RexLiteral> constants, RelDataType rowType, 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)
RelNodeIf 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 RelNodeisValid in class AbstractRelNodelitmus - What to do if invalidcontext - Context for validity checkingpublic RelWriter explainTerms(RelWriter pw)
AbstractRelNodesuper.explainTerms, then call the
RelWriterImpl.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms in class SingleRelpw - Plan writerpublic static ImmutableIntList getProjectOrdinals(List<RexNode> exprs)
public static RelCollation getCollation(List<RexFieldCollation> collations)
public List<RexLiteral> getConstants()
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNodeNOTE 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 RelNodecomputeSelfCost in class AbstractRelNodeplanner - Planner for cost calculationmq - Metadata queryCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.