|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.relopt.RelOptRule org.eigenbase.rel.rules.PullConstantsThroughAggregatesRule
public class PullConstantsThroughAggregatesRule
PullConstantsThroughAggregatesRule removes constant expressions from the
group list of an AggregateRel
.
Since the transformed relational expression has to match the original relational expression, the constants are placed in a projection above the reduced aggregate. If those constants are not used, another rule will remove them from the project.
AggregateRel needs its group columns to be on the prefix of its input relational expression. Therefore, if a constant is not on the trailing edge of the group list, removing it will leave a hole. In this case, the rule adds a project before the aggregate to reorder the columns, and permutes them back afterwards.
Field Summary | |
---|---|
static PullConstantsThroughAggregatesRule |
instance
The singleton. |
Fields inherited from class org.eigenbase.relopt.RelOptRule |
---|
ANY, description, operands |
Constructor Summary | |
---|---|
private |
PullConstantsThroughAggregatesRule()
Private: use singleton |
Method Summary | |
---|---|
private static RelNode |
createProjection(Mapping mapping,
RelNode child)
Creates a projection which permutes the fields of a given relational expression. |
void |
onMatch(RelOptRuleCall call)
Receives notification about a rule match. |
Methods inherited from class org.eigenbase.relopt.RelOptRule |
---|
convert, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PullConstantsThroughAggregatesRule instance
Constructor Detail |
---|
private PullConstantsThroughAggregatesRule()
Method Detail |
---|
public void onMatch(RelOptRuleCall call)
RelOptRule
call.rels
holds the set of relational
expressions which match the operands to the rule;
call.rels[0]
is the root expression.
Typically a rule would check that the nodes are valid matches, creates
a new expression, then calls back RelOptRuleCall.transformTo(org.eigenbase.rel.RelNode)
to
register the expression.
onMatch
in class RelOptRule
call
- Rule callRelOptRule.matches(RelOptRuleCall)
private static RelNode createProjection(Mapping mapping, RelNode child)
For example, given a relational expression [A, B, C, D] and a mapping [2:1, 3:0], returns a projection [$3 AS C, $2 AS B].
mapping
- Mapping to apply to source columnschild
- Relational expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |