public abstract class Window
extends org.apache.calcite.rel.SingleRel
implements org.apache.calcite.rel.hint.Hintable
Temporarily copy from calcite to cherry-pick [CALCITE-5107] and will be removed when upgrade the latest calcite.
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.
|
Modifier and Type | Field and Description |
---|---|
com.google.common.collect.ImmutableList<RexLiteral> |
constants |
com.google.common.collect.ImmutableList<Window.Group> |
groups |
protected com.google.common.collect.ImmutableList<org.apache.calcite.rel.hint.RelHint> |
hints |
Constructor and Description |
---|
Window(org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.plan.RelTraitSet traitSet,
List<org.apache.calcite.rel.hint.RelHint> hints,
org.apache.calcite.rel.RelNode input,
List<RexLiteral> constants,
org.apache.calcite.rel.type.RelDataType rowType,
List<Window.Group> groups)
Creates a window relational expression.
|
Window(org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.plan.RelTraitSet traitSet,
org.apache.calcite.rel.RelNode input,
List<RexLiteral> constants,
org.apache.calcite.rel.type.RelDataType rowType,
List<Window.Group> groups)
Creates a window relational expression.
|
Modifier and Type | Method and Description |
---|---|
org.apache.calcite.plan.RelOptCost |
computeSelfCost(org.apache.calcite.plan.RelOptPlanner planner,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
org.apache.calcite.rel.RelWriter |
explainTerms(org.apache.calcite.rel.RelWriter pw) |
static org.apache.calcite.rel.RelCollation |
getCollation(List<org.apache.calcite.rex.RexFieldCollation> collations) |
List<RexLiteral> |
getConstants()
Returns constants that are additional inputs of current relation.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rel.hint.RelHint> |
getHints() |
static org.apache.calcite.util.ImmutableIntList |
getProjectOrdinals(List<org.apache.calcite.rex.RexNode> exprs) |
boolean |
isValid(org.apache.calcite.util.Litmus litmus,
org.apache.calcite.rel.RelNode.Context context) |
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
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
public final com.google.common.collect.ImmutableList<Window.Group> groups
public final com.google.common.collect.ImmutableList<RexLiteral> constants
protected final com.google.common.collect.ImmutableList<org.apache.calcite.rel.hint.RelHint> hints
public Window(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.hint.RelHint> hints, org.apache.calcite.rel.RelNode input, List<RexLiteral> constants, org.apache.calcite.rel.type.RelDataType rowType, List<Window.Group> groups)
cluster
- ClustertraitSet
- Trait sethints
- Hints for this nodeinput
- Input relational expressionconstants
- List of constants that are additional inputsrowType
- Output row typegroups
- Windowspublic Window(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, org.apache.calcite.rel.RelNode input, List<RexLiteral> constants, org.apache.calcite.rel.type.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(org.apache.calcite.util.Litmus litmus, org.apache.calcite.rel.RelNode.Context context)
isValid
in interface org.apache.calcite.rel.RelNode
isValid
in class org.apache.calcite.rel.AbstractRelNode
public org.apache.calcite.rel.RelWriter explainTerms(org.apache.calcite.rel.RelWriter pw)
explainTerms
in class org.apache.calcite.rel.SingleRel
public static org.apache.calcite.util.ImmutableIntList getProjectOrdinals(List<org.apache.calcite.rex.RexNode> exprs)
public static org.apache.calcite.rel.RelCollation getCollation(List<org.apache.calcite.rex.RexFieldCollation> collations)
public List<RexLiteral> getConstants()
public org.apache.calcite.plan.RelOptCost computeSelfCost(org.apache.calcite.plan.RelOptPlanner planner, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
computeSelfCost
in interface org.apache.calcite.rel.RelNode
computeSelfCost
in class org.apache.calcite.rel.AbstractRelNode
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.hint.RelHint> getHints()
getHints
in interface org.apache.calcite.rel.hint.Hintable
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.