- All Implemented Interfaces:
public abstract class BaseAggregateWindow extends Object implements SerializableAbstract base class for all custom java aggregate functions.
All custom java aggregate classes must extend AggregateWindow. The user's subclass must implement at least one
accumulatemethod that corresponds to the argument number and data types that a StreamBase expression (using calljava or its alias) refers to (typically used in Aggregate and Query operators). The
accumulatemethod will be called each time new data arrives for the window.
There may be many overloaded
accumulatemethods, all with void return.
The user's subclass must also implement a
calculatemethod. When data is sent from the aggregate window, The
calculatemethod must return a type matching a StreamBase data type (for Strings you may also return byte, for blobs you must use
ByteArrayView). The return type may be the Java primitive or the Java Object which allows a null return type.
The calculate method will be called whenever a new tuple is generated. The calculate method may be called just once (as in the case when a tuple is generated when the aggregate window closes) or many times (as in the case when the aggregate window remains open, but a tuple is generated because "emit every N tuples" was selected).
It is also possible that calculate may be called before accumulate is called. It is also possible that calculate may never be called.
The AggregateWindow object is likely to be used several times. At the start of each new use, the init() method will be called. Then accumulate and calculate may be called. Finally, at the end of each use, release will be called.
Note: Serializations of instances of this class that are created (e.g., by using
ObjectOutputStream) in one version of StreamBase in general will not be deserializable in any other version of StreamBase.
- See Also:
- Serialized Form
Constructors Constructor Description
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
getEnv()Get runtime environment
init()Called before each new use of this object.
release()Called after the end of a use of this object.
setRuntimeEnv(Object env)Called by internal streambase code to set the runtime environment
public abstract void init()Called before each new use of this object.
public void release()Called after the end of a use of this object.
public abstract void setRuntimeEnv(Object env)Called by internal streambase code to set the runtime environment
env- Runtime environment
public abstract Object getEnv()Get runtime environment