org.eigenbase.oj.rex
Class OJRexImplementorTableImpl.OJCountAggImplementor

java.lang.Object
  extended by org.eigenbase.oj.rex.OJRexImplementorTableImpl.OJBasicAggImplementor
      extended by org.eigenbase.oj.rex.OJRexImplementorTableImpl.OJCountAggImplementor
All Implemented Interfaces:
OJAggImplementor
Enclosing class:
OJRexImplementorTableImpl

public static class OJRexImplementorTableImpl.OJCountAggImplementor
extends OJRexImplementorTableImpl.OJBasicAggImplementor


Constructor Summary
OJRexImplementorTableImpl.OJCountAggImplementor()
           
 
Method Summary
 boolean canMerge()
          Returns whether this aggregation can merge together two accumulators.
 void implementNext(JavaRelImplementor implementor, JavaRel rel, Expression accumulator, AggregateCall call)
          Generates (into the current statement list, gleaned by calling implementor's JavaRelImplementor.getStatementList() method) the piece of code which gets called each time an extra row is seen.
 Expression implementResult(JavaRelImplementor implementor, Expression accumulator, AggregateCall call)
          Generates the expression which gets called when a total is complete.
 Expression implementStart(JavaRelImplementor implementor, JavaRel rel, AggregateCall call)
          Generates the expression which gets called when a new total is created.
 
Methods inherited from class org.eigenbase.oj.rex.OJRexImplementorTableImpl.OJBasicAggImplementor
implementMerge, implementStartAndNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OJRexImplementorTableImpl.OJCountAggImplementor

public OJRexImplementorTableImpl.OJCountAggImplementor()
Method Detail

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
Overrides:
canMerge in class OJRexImplementorTableImpl.OJBasicAggImplementor
Returns:
whether this aggregation can merge together two accumulators

implementNext

public void implementNext(JavaRelImplementor implementor,
                          JavaRel rel,
                          Expression accumulator,
                          AggregateCall call)
Description copied from interface: OJAggImplementor
Generates (into the current statement list, gleaned by calling implementor's JavaRelImplementor.getStatementList() method) the piece of code which gets called each time an extra row is seen. For sum(x), this looks like ((org.eigenbase.runtime.Holder.int_Holder) accumulator).value += x.

Parameters:
implementor - a callback object which knows how to generate things
rel - the relational expression which is generating this code
accumulator - the expression which holds the total
call - the ordinals of the fields of the child row which are arguments to this aggregation

implementResult

public Expression implementResult(JavaRelImplementor implementor,
                                  Expression accumulator,
                                  AggregateCall call)
Description copied from interface: OJAggImplementor
Generates the expression which gets called when a total is complete. For sum(x), this looks like ((saffron.runtime.Holder.int_Holder) accumulator).value.


implementStart

public Expression implementStart(JavaRelImplementor implementor,
                                 JavaRel rel,
                                 AggregateCall call)
Description copied from interface: OJAggImplementor
Generates the expression which gets called when a new total is created. For sum(x), this looks like new saffron.runtime.Holder.int_Holder(0).