|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.rel.AbstractRelNode org.eigenbase.rel.SingleRel org.eigenbase.rel.CalcRelBase org.eigenbase.rel.CalcRel
public final class CalcRel
A relational expression which computes project expressions and also filters.
This relational expression combines the functionality of ProjectRel
and FilterRel
. It should be created in the latter stages
of optimization, by merging consecutive ProjectRel
and FilterRel
nodes together.
The following rules relate to CalcRel
:
FilterToCalcRule
creates this from a FilterRel
ProjectToCalcRule
creates this from a FilterRel
MergeFilterOntoCalcRule
merges this with a FilterRel
MergeProjectOntoCalcRule
merges this with a ProjectRel
MergeCalcRule
merges two CalcRels
Field Summary | |
---|---|
static boolean |
DeprecateProjectAndFilter
|
Fields inherited from class org.eigenbase.rel.CalcRelBase |
---|
program |
Fields inherited from class org.eigenbase.rel.AbstractRelNode |
---|
digest, id, nextId, rowType, traits |
Fields inherited from interface org.eigenbase.rel.RelNode |
---|
emptyArray |
Constructor Summary | |
---|---|
CalcRel(RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
RelDataType rowType,
RexProgram program,
List<RelCollation> collationList)
|
Method Summary | |
---|---|
CalcRel |
clone()
Clones this RelNode. |
void |
collectVariablesUsed(Set<String> variableSet)
Collects variables known to be used by this expression or its descendants. |
static RelNode |
createFilter(RelNode child,
RexNode condition)
Creates a relational expression which filters according to a given condition, returning the same fields as its input. |
static RelNode |
createProject(RelNode child,
List<Integer> posList)
|
static RelNode |
createProject(RelNode child,
List<RexNode> exprList,
List<String> fieldNameList)
Creates a relational expression which projects an array of expressions. |
static RelNode |
createProject(RelNode child,
List<RexNode> exprList,
List<String> fieldNameList,
boolean optimize)
Creates a relational expression which projects an array of expressions, and optionally optimizes. |
static ProjectRel |
createProject(RelNode child,
RexNode[] exprs,
String[] fieldNames)
Creates a relational expression which projects a set of expressions. |
static RelNode |
createProject(RelNode child,
RexNode[] exprs,
String[] fieldNames,
boolean optimize)
Creates a relational expression which projects a set of expressions. |
static RelNode |
createRename(RelNode rel,
String[] fieldNames)
Returns a relational expression which has the same fields as the underlying expression, but the fields have different names. |
static RelNode |
permute(RelNode rel,
Permutation permutation,
List<String> fieldNames)
Creates a relational expression which permutes the output fields of a relational expression according to a permutation. |
static RelNode |
projectMapping(RelNode rel,
Mapping mapping,
List<String> fieldNames)
Creates a relational expression which projects the output fields of a relational expression according to a partial mapping. |
Methods inherited from class org.eigenbase.rel.CalcRelBase |
---|
computeSelfCost, explain, getChildExps, getCollationList, getProgram, getRows, isValid |
Methods inherited from class org.eigenbase.rel.SingleRel |
---|
childrenAccept, deriveRowType, getChild, getInputs, replaceInput |
Methods inherited from class org.eigenbase.rel.AbstractRelNode |
---|
cloneTraits, collectVariablesSet, computeDigest, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, inheritTraitsFrom, isAccessTo, isDistinct, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean DeprecateProjectAndFilter
Constructor Detail |
---|
public CalcRel(RelOptCluster cluster, RelTraitSet traits, RelNode child, RelDataType rowType, RexProgram program, List<RelCollation> collationList)
Method Detail |
---|
public CalcRel clone()
RelNode
Traits of the RelNode must be explicitly cloned, using AbstractRelNode.inheritTraitsFrom(AbstractRelNode)
, as the RelNode may
have traits of which it has no knowledge. Example implementation:
public MyRelNode clone() { MyRelNode clone = new MyRelNode(...); clone.inheritTraitsFrom(this); return clone; }N.B.: This method must be overridden whenever an existing, concrete RelNode is extended. Otherwise, calling clone() will produce a differently typed RelNode, resulting in invalid or incorrect query plans.
clone
in interface RelNode
clone
in class AbstractRelNode
public static RelNode createProject(RelNode child, List<RexNode> exprList, List<String> fieldNameList)
child
- input relational expressionexprList
- list of expressions for the input columnsfieldNameList
- aliases of the expressions, or null to generatepublic static RelNode createProject(RelNode child, List<RexNode> exprList, List<String> fieldNameList, boolean optimize)
child
- input relational expressionexprList
- list of expressions for the input columnsfieldNameList
- aliases of the expressions, or null to generateoptimize
- Whether to return child
unchanged if the
projections are trivial.public static ProjectRel createProject(RelNode child, RexNode[] exprs, String[] fieldNames)
child
- input relational expressionexprs
- set of expressions for the input columnsfieldNames
- aliases of the expressions, or null to generatepublic static RelNode createProject(RelNode child, List<Integer> posList)
public static RelNode createProject(RelNode child, RexNode[] exprs, String[] fieldNames, boolean optimize)
The result may not be a ProjectRel
. If the projection is
trivial, child
is returned directly; and future versions may
return other forumlations of expressions, such as CalcRel
.
child
- input relational expressionexprs
- set of expressions for the input columnsfieldNames
- aliases of the expressions, or null to generateoptimize
- Whether to return child
unchanged if the
projections are trivial.public static RelNode createFilter(RelNode child, RexNode condition)
child
- Child relational expressioncondition
- Condition
public static RelNode createRename(RelNode rel, String[] fieldNames)
rel
- Relational expressionfieldNames
- Field names
public void collectVariablesUsed(Set<String> variableSet)
RelNode
collectVariablesUsed
in interface RelNode
collectVariablesUsed
in class AbstractRelNode
variableSet
- receives variables usedpublic static RelNode permute(RelNode rel, Permutation permutation, List<String> fieldNames)
Optimizations:
CalcRel
or ProjectRel
which is already acting as a permutation, combines the new
permuation with the old;If a permutation is combined with its inverse, these optimizations would combine to remove them both.
rel
- permutation
- fieldNames
- Field names; if null, or if a particular entry is null,
the name of the permuted field is used
public static RelNode projectMapping(RelNode rel, Mapping mapping, List<String> fieldNames)
A partial mapping is weaker than a permutation: every target has one source, but a source may have 0, 1 or more than one targets. Usually the result will have fewer fields than the source, unless some source fields are projected multiple times.
This method could optimize the result as permute(org.eigenbase.rel.RelNode, org.eigenbase.util.Permutation, java.util.List
does, but
does not at present.
rel
- Relational expressionmapping
- Mapping from source fields to target fields. The mapping
type must obey the constaints MappingType.isMandatorySource()
and
MappingType.isSingleSource()
, as does MappingType.InverseFunction
.fieldNames
- Field names; if null, or if a particular entry is null,
the name of the permuted field is used
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |