public abstract class AggregateFunction extends ConsumerProducerFunction implements Cloneable
AggregateFunction is a ConsumerProducerFunction that reduces a number of
input records to a single output of the same record type. The function will update it's internal state in response
to new input records, and return the current state on request.
For example:
AggregateFunction sum = new Sum();
sum.aggregate({1}); sum.aggregate({2}); sum.aggregate({3});
Object[] state = sum.state() // state = {6}
| Constructor and Description |
|---|
AggregateFunction() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
aggregate(Object[] input)
Execute this
AggregateFunction with an input record. |
abstract void |
init()
Initialise the internal state of this
AggregateFunction. |
abstract Object[] |
state() |
abstract AggregateFunction |
statelessClone()
Create a deep copy of this
AggregateFunction, with it's internal state initialised. |
equals, getOutputClasses, hashCode, toStringgetInputClassespublic abstract void init()
AggregateFunction.
This will normally involve setting an aggregate field back to null.public abstract void aggregate(Object[] input)
AggregateFunction with an input record. Input records should match the types reported
by getInputClasses().input - Input record.public abstract Object[] state()
public abstract AggregateFunction statelessClone()
AggregateFunction, with it's internal state initialised.statelessClone in interface FunctionstatelessClone in class ConsumerProducerFunctionCopyright © 2017. All rights reserved.