|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectstreamcruncher.api.aggregator.AbstractAggregator
public abstract class AbstractAggregator
Custom Aggregator functions can be plugged into the Kernel before the Query is registered. The APIs provide a means to register and unregister these custom functions. Such custom Aggregators must extend this Class. The Sub-classes must have a no argument constructor.
When the Kernel creates a Window in a Partition that uses the function name against which this Aggregate is registered, an instance of the registered Class is created and used. When the Window expires, the corresponding Aggregator instance is also discarded.
| Nested Class Summary | |
|---|---|
static class |
AbstractAggregator.AggregationStage
This feature is to provide a choice for the User to decide whether an Event's entrance into a Window only or both entrance and exit should affect the aggregate. |
| Constructor Summary | |
|---|---|
AbstractAggregator()
|
|
| Method Summary | |
|---|---|
abstract java.lang.Object |
aggregate(java.util.List<java.lang.Object[]> removedValues,
java.util.List<java.lang.Object[]> addedValues)
At the end of each Query execution, this method will be called to aggregate the Events in the Window over which this Aggregate is created. |
AbstractAggregator.AggregationStage |
getAggregationStage()
|
java.util.LinkedHashMap<java.lang.String,java.lang.String> |
getColumnNamesAndTypes()
|
java.lang.String[] |
getParams()
|
void |
init(java.lang.String[] params,
java.util.LinkedHashMap<java.lang.String,java.lang.String> columnNamesAndTypes,
AbstractAggregator.AggregationStage aggregationStage)
Note: This class' method must be invoked even if it is over-ridden (i.e super.init(...)). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractAggregator()
| Method Detail |
|---|
public void init(java.lang.String[] params,
java.util.LinkedHashMap<java.lang.String,java.lang.String> columnNamesAndTypes,
AbstractAggregator.AggregationStage aggregationStage)
super.init(...)).
params - Parameters that were supplied to the function in the "Running
Query". Ex: A definition such as
with custom(test_fn, order_id, J) as test_fn_val
will produce String[]{"order_id", "J"}columnNamesAndTypes - The same order in which the columns are placed in Lists in
aggregate(List, List).aggregationStage - public java.util.LinkedHashMap<java.lang.String,java.lang.String> getColumnNamesAndTypes()
public java.lang.String[] getParams()
public AbstractAggregator.AggregationStage getAggregationStage()
public abstract java.lang.Object aggregate(java.util.List<java.lang.Object[]> removedValues,
java.util.List<java.lang.Object[]> addedValues)
At the end of each Query execution, this method will be called to aggregate the Events in the Window over which this Aggregate is created.
One of the parameters (added/removed) can be null. But,
never both.
removedValues - List of rows that were removed in the current cycle. Each
array in the list is a group of columns in that Row.addedValues - List of rows added in the current cycle. Each array in the
list is a group of columns in that Row.
null for some cases (Ex:
In-built functions return a null if the aggregate
calculation yields a NaN).for the names and types of the data/columns.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||