org.eigenbase.rel.rules
Class ReduceAggregatesRule
java.lang.Object
org.eigenbase.relopt.RelOptRule
org.eigenbase.rel.rules.ReduceAggregatesRule
public class ReduceAggregatesRule
- extends RelOptRule
Rule to reduce aggregates to simpler forms. Currently only AVG(x) to
SUM(x)/COUNT(x), but eventually will handle others such as STDDEV.
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/rel/rules/ReduceAggregatesRule.java#10 $
- Author:
- John V. Sichi
Methods inherited from class org.eigenbase.relopt.RelOptRule |
convert, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString |
instance
public static final ReduceAggregatesRule instance
- The singleton.
ReduceAggregatesRule
protected ReduceAggregatesRule(RelOptRuleOperand operand)
onMatch
public void onMatch(RelOptRuleCall ruleCall)
- Description copied from class:
RelOptRule
- Receives notification about a rule match. At the time that this method is
called,
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.
- Specified by:
onMatch
in class RelOptRule
- Parameters:
ruleCall
- Rule call- See Also:
RelOptRule.matches(RelOptRuleCall)
reduceAverages
private void reduceAverages(RelOptRuleCall ruleCall,
AggregateRelBase oldAggRel)
newAggregateRel
protected AggregateRelBase newAggregateRel(AggregateRelBase oldAggRel,
List<AggregateCall> newCalls)
- Do a shallow clone of oldAggRel and update aggCalls. Could be refactored
into AggregateRelBase and subclasses - but it's only needed for some
subclasses.
- Parameters:
oldAggRel
- AggregateRel to clone.newCalls
- New list of AggregateCalls
- Returns:
- shallow clone with new list of AggregateCalls.
getField
private RelDataType getField(RelNode relNode,
int i)