org.eigenbase.oj.rex
Class OJRexImplementorTableImpl.OJBasicAggImplementor
java.lang.Object
org.eigenbase.oj.rex.OJRexImplementorTableImpl.OJBasicAggImplementor
- All Implemented Interfaces:
- OJAggImplementor
- Direct Known Subclasses:
- OJRexImplementorTableImpl.OJCountAggImplementor, OJRexImplementorTableImpl.OJMinMaxAggImplementor, OJRexImplementorTableImpl.OJSumAggImplementor
- Enclosing class:
- OJRexImplementorTableImpl
public abstract static class OJRexImplementorTableImpl.OJBasicAggImplementor
- extends Object
- implements OJAggImplementor
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OJRexImplementorTableImpl.OJBasicAggImplementor
public OJRexImplementorTableImpl.OJBasicAggImplementor()
canMerge
public boolean canMerge()
- Description copied from interface:
OJAggImplementor
- Returns whether this aggregation can merge together two accumulators.
For example, COUNT
can (you just add the accumulators);
AVG
and MEDIAN
cannot.
- Specified by:
canMerge
in interface OJAggImplementor
- Returns:
- whether this aggregation can merge together two accumulators
implementMerge
public void implementMerge(JavaRelImplementor implementor,
RelNode rel,
Expression accumulator,
Expression otherAccumulator)
- Description copied from interface:
OJAggImplementor
- Generates (into the current statement list, gleaned by calling
implementor
's JavaRelImplementor.getStatementList()
method) code to
merge two accumulators. For sum(x)
, this looks like
((saffron.runtime.Holder.int_Holder) accumulator).value +=
((saffron.runtime.Holder.int_Holder) other).value
.
The method is only called if OJAggImplementor.canMerge()
returns
true
.
- Specified by:
implementMerge
in interface OJAggImplementor
- Parameters:
implementor
- a callback object which knows how to generate thingsrel
- the relational expression which is generating this codeaccumulator
- the expression which holds the totalotherAccumulator
- accumulator to merge in
implementStartAndNext
public Expression implementStartAndNext(JavaRelImplementor implementor,
JavaRel rel,
AggregateCall call)
- This is a default implementation of
OJAggImplementor.implementStartAndNext(org.eigenbase.oj.rel.JavaRelImplementor, org.eigenbase.oj.rel.JavaRel, org.eigenbase.rel.AggregateCall)
;
particular derived classes may do better.
- Specified by:
implementStartAndNext
in interface OJAggImplementor