Package org.apache.calcite.rel.rules
Class ProjectToWindowRule.WindowedAggRelSplitter
- java.lang.Object
-
- org.apache.calcite.rel.rules.CalcRelSplitter
-
- org.apache.calcite.rel.rules.ProjectToWindowRule.WindowedAggRelSplitter
-
- Enclosing class:
- ProjectToWindowRule
static class ProjectToWindowRule.WindowedAggRelSplitter extends CalcRelSplitter
Splitter that distinguishes between windowed aggregation expressions (calls toRexOver
) and ordinary expressions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.rel.rules.CalcRelSplitter
CalcRelSplitter.RelType
-
-
Field Summary
Fields Modifier and Type Field Description private static CalcRelSplitter.RelType[]
REL_TYPES
-
Fields inherited from class org.apache.calcite.rel.rules.CalcRelSplitter
program, relBuilder
-
-
Constructor Summary
Constructors Constructor Description WindowedAggRelSplitter(Calc calc, RelBuilder relBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private DirectedGraph<java.lang.Integer,DefaultEdge>
createGraphFromExpression(java.util.List<RexNode> exprs)
protected java.util.List<java.util.Set<java.lang.Integer>>
getCohorts()
Returns a list of sets of expressions that should be on the same level.private java.util.List<java.lang.Integer>
getRank(DirectedGraph<java.lang.Integer,DefaultEdge> graph)
private boolean
isDependent(DirectedGraph<java.lang.Integer,DefaultEdge> graph, java.util.List<java.lang.Integer> rank, int ordinal1, int ordinal2)
-
Methods inherited from class org.apache.calcite.rel.rules.CalcRelSplitter
canImplement, execute, handle
-
-
-
-
Field Detail
-
REL_TYPES
private static final CalcRelSplitter.RelType[] REL_TYPES
-
-
Constructor Detail
-
WindowedAggRelSplitter
WindowedAggRelSplitter(Calc calc, RelBuilder relBuilder)
-
-
Method Detail
-
getCohorts
protected java.util.List<java.util.Set<java.lang.Integer>> getCohorts()
Description copied from class:CalcRelSplitter
Returns a list of sets of expressions that should be on the same level.For example, if this method returns { {3, 5}, {4, 7} }, it means that expressions 3 and 5, should be on the same level, and expressions 4 and 7 should be on the same level. The two cohorts do not need to be on the same level.
The list is best effort. If it is not possible to arrange that the expressions in a cohort are on the same level, the
CalcRelSplitter.execute()
method will still succeed.The default implementation of this method returns the empty list; expressions will be put on the most suitable level. This is generally the lowest possible level, except for literals, which are placed at the level where they are used.
- Overrides:
getCohorts
in classCalcRelSplitter
- Returns:
- List of cohorts, that is sets of expressions, that the splitting algorithm should attempt to place on the same level
-
isDependent
private boolean isDependent(DirectedGraph<java.lang.Integer,DefaultEdge> graph, java.util.List<java.lang.Integer> rank, int ordinal1, int ordinal2)
-
getRank
private java.util.List<java.lang.Integer> getRank(DirectedGraph<java.lang.Integer,DefaultEdge> graph)
-
createGraphFromExpression
private DirectedGraph<java.lang.Integer,DefaultEdge> createGraphFromExpression(java.util.List<RexNode> exprs)
-
-