|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OJAggImplementor
Translates a call to an Aggregation
into OpenJava
code.
Implementors are held in a OJRexImplementorTable
.
Method Summary | |
---|---|
boolean |
canMerge()
Returns whether this aggregation can merge together two accumulators. |
void |
implementMerge(JavaRelImplementor implementor,
RelNode rel,
Expression accumulator,
Expression otherAccumulator)
Generates (into the current statement list, gleaned by calling
implementor 's JavaRelImplementor.getStatementList() method) code to
merge 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. |
Expression |
implementStartAndNext(JavaRelImplementor implementor,
JavaRel rel,
AggregateCall call)
Generates code to create a new total and to add the first value. |
Method Detail |
---|
Expression implementStart(JavaRelImplementor implementor, JavaRel rel, AggregateCall call)
sum(x)
, this looks like new
saffron.runtime.Holder.int_Holder(0)
.
Expression implementStartAndNext(JavaRelImplementor implementor, JavaRel rel, AggregateCall call)
sum(x)
, this looks like new
saffron.runtime.Holder.int_Holder(x)
.
boolean canMerge()
For example, COUNT
can (you just add the accumulators);
AVG
and MEDIAN
cannot.
void implementMerge(JavaRelImplementor implementor, RelNode rel, Expression accumulator, Expression otherAccumulator)
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 canMerge()
returns
true
.
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 invoid implementNext(JavaRelImplementor implementor, JavaRel rel, Expression accumulator, AggregateCall call)
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
.
implementor
- a callback object which knows how to generate thingsrel
- the relational expression which is generating this codeaccumulator
- the expression which holds the totalcall
- the ordinals of the fields of the child row which are
arguments to this aggregationExpression implementResult(JavaRelImplementor implementor, Expression accumulator, AggregateCall call)
sum(x)
, this looks like
((saffron.runtime.Holder.int_Holder) accumulator).value
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |