Package com.hazelcast.jet.pipeline
Class AggregateBuilder<R0>
- java.lang.Object
-
- com.hazelcast.jet.pipeline.AggregateBuilder<R0>
-
- Type Parameters:
R0
- type of the result of the aggregate operation applied to stage-0 (the one you obtained this builder from)
public class AggregateBuilder<R0> extends java.lang.Object
Offers a step-by-step API to build a pipeline stage that co-aggregates the data from several input stages. To obtain it, callBatchStage.aggregateBuilder()
on the first stage you are co-aggregating and refer to that method's Javadoc for further details.Note: this is not a builder of
AggregateOperation
. If that's what you are looking for, gohere
.- Since:
- Jet 3.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T,R>
Tag<R>add(BatchStage<T> stage, AggregateOperation1<? super T,?,? extends R> aggrOp)
Adds another stage that will contribute its data to the aggregate operation to be performed.BatchStage<ItemsByTag>
build()
Creates and returns a pipeline stage that performs the co-aggregation of the stages registered with this builder object.<R> BatchStage<R>
build(FunctionEx<? super ItemsByTag,? extends R> finishFn)
Creates and returns a pipeline stage that performs the co-aggregation of the stages registered with this builder object.Tag<R0>
tag0()
Returns the tag corresponding to the pipeline stage this builder was obtained from.
-
-
-
Method Detail
-
tag0
@Nonnull public Tag<R0> tag0()
Returns the tag corresponding to the pipeline stage this builder was obtained from. Use it to get the results for this stage from theItemsByTag
appearing in the output of the stage you are building.
-
add
@Nonnull public <T,R> Tag<R> add(@Nonnull BatchStage<T> stage, @Nonnull AggregateOperation1<? super T,?,? extends R> aggrOp)
Adds another stage that will contribute its data to the aggregate operation to be performed. Returns the tag you'll use to get the results for this stage from theItemsByTag
appearing in the output of the stage you are building.
-
build
@Nonnull public <R> BatchStage<R> build(@Nonnull FunctionEx<? super ItemsByTag,? extends R> finishFn)
Creates and returns a pipeline stage that performs the co-aggregation of the stages registered with this builder object. The composite aggregate operation places the results of the individual aggregate operations in anItemsByTag
and thefinishFn
you supply transforms it to the final result to emit. Use the tags you got from this builder in the implementation offinishFn
to access the results.- Type Parameters:
R
- the output item type- Parameters:
finishFn
- the finishing function for the composite aggregate operation. It must be stateless and cooperative.- Returns:
- a new stage representing the co-aggregation
-
build
@Nonnull public BatchStage<ItemsByTag> build()
Creates and returns a pipeline stage that performs the co-aggregation of the stages registered with this builder object. The composite aggregate operation places the results of the individual aggregate operations in anItemsByTag
. Use the tags you got from this builder to access the results.- Returns:
- a new stage representing the co-aggregation
-
-