public abstract class CalcRelSplitter extends Object
Calc with multiple RexCall
sub-expressions that cannot all be implemented by a single concrete
RelNode.
For example, the Java and Fennel calculator do not implement an identical set of operators. The Calc can be used to split a single Calc with mixed Java- and Fennel-only operators into a tree of Calc object that can each be individually implemented by either Java or Fennel.and splits it into several Calc instances.
Currently the splitter is only capable of handling two "rel types". That is, it can deal with Java vs. Fennel Calcs, but not Java vs. Fennel vs. some other type of Calc.
See ProjectToWindowRule
for an example of how this class is used.
| Modifier and Type | Class and Description |
|---|---|
static class |
CalcRelSplitter.RelType
Type of relational expression.
|
| Modifier and Type | Field and Description |
|---|---|
protected RexProgram |
program |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canImplement(LogicalCalc rel,
String relTypeName)
Returns whether a relational expression can be implemented solely in a
given
CalcRelSplitter.RelType. |
protected List<Set<Integer>> |
getCohorts()
Returns a list of sets of expressions that should be on the same level.
|
protected RelNode |
handle(RelNode rel)
Opportunity to further refine the relational expression created for a
given level.
|
protected final RexProgram program
protected RelNode handle(RelNode rel)
protected boolean canImplement(LogicalCalc rel, String relTypeName)
CalcRelSplitter.RelType.rel - Calculation relational expressionrelTypeName - Name of a CalcRelSplitter.RelTypeprotected List<Set<Integer>> getCohorts()
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 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.
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.