|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.saffron.oj.rel.BuiltinAggregation
BuiltinAggregation
is a basic aggregator for which special
code is generated.
Nested Class Summary | |
(package private) static class |
BuiltinAggregation.Count
Count is an aggregator which returns the number of rows
which have gone into it. |
(package private) static class |
BuiltinAggregation.MinMax
MinMax implements the "min" and "max" aggregator
functions, returning the returns the smallest/largest of the values
which go into it. |
(package private) static class |
BuiltinAggregation.Sum
Sum is an aggregator which returns the sum of the values
which go into it. |
Constructor Summary | |
BuiltinAggregation()
|
Method Summary | |
boolean |
canMerge()
Whether this aggregation can merge together two accumulators. |
static int |
count()
|
static int |
count(double v)
|
static int |
count(int v)
|
static int |
count(Object v)
|
static BuiltinAggregation |
create(String name,
OJClass[] argTypes)
Creates a BuiltinAggregation with a given name and
argument types. |
(package private) abstract String |
getName()
|
protected abstract OJClass[] |
getParameterTypes()
|
SaffronType[] |
getParameterTypes(SaffronTypeFactory typeFactory)
|
protected abstract OJClass |
getReturnType()
|
SaffronType |
getReturnType(SaffronTypeFactory typeFactory)
|
void |
implementMerge(RelImplementor implementor,
SaffronRel rel,
Expression accumulator,
Expression otherAccumulator)
Generates (into the current statement list, gleaned by calling implementor 's RelImplementor.getStatementList() method) code to
merge two accumulators. |
Expression |
implementStartAndNext(RelImplementor implementor,
SaffronRel rel,
int[] args)
This is a default implementation of Aggregation.implementStartAndNext(net.sf.saffron.opt.RelImplementor, net.sf.saffron.rel.SaffronRel, int[]) ; particular derived classes may do
better. |
static OJMethod |
lookup(String name,
OJClass[] argTypes)
Returns the builtin aggregator with a given name, if there is one. |
static double |
max(double v)
|
static double |
max(int v)
|
static int |
max(Object v)
|
static double |
min(double v)
|
static double |
min(int v)
|
static int |
min(Object v)
|
static double |
sum(double v)
|
static int |
sum(int v)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.saffron.rel.Aggregation |
implementNext, implementResult, implementStart |
Constructor Detail |
public BuiltinAggregation()
Method Detail |
public static int count()
public static int count(Object v)
public static int count(int v)
public static int count(double v)
public static BuiltinAggregation create(String name, OJClass[] argTypes)
BuiltinAggregation
with a given name and
argument types.
public SaffronType[] getParameterTypes(SaffronTypeFactory typeFactory)
getParameterTypes
in interface Aggregation
public SaffronType getReturnType(SaffronTypeFactory typeFactory)
getReturnType
in interface Aggregation
public boolean canMerge()
Aggregation
count
can (you just add the accumulators);
avg
and Nth
cannot.
canMerge
in interface Aggregation
public void implementMerge(RelImplementor implementor, SaffronRel rel, Expression accumulator, Expression otherAccumulator)
Aggregation
implementor
's RelImplementor.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 Aggregation.canMerge()
returns
true
.
implementMerge
in interface Aggregation
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 inpublic Expression implementStartAndNext(RelImplementor implementor, SaffronRel rel, int[] args)
Aggregation.implementStartAndNext(net.sf.saffron.opt.RelImplementor, net.sf.saffron.rel.SaffronRel, int[])
; particular derived classes may do
better.
implementStartAndNext
in interface Aggregation
public static OJMethod lookup(String name, OJClass[] argTypes)
public static int max(Object v)
public static double max(int v)
public static double max(double v)
public static int min(Object v)
public static double min(int v)
public static double min(double v)
public static int sum(int v)
public static double sum(double v)
protected abstract OJClass[] getParameterTypes()
protected abstract OJClass getReturnType()
abstract String getName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |