use of com.hazelcast.jet.impl.pipeline.transform.WindowAggregateTransform in project hazelcast by hazelcast.
the class AggBuilder method build.
@Nonnull
@SuppressWarnings({ "unchecked", "rawtypes" })
public <A, R, OUT, OUT_STAGE extends GeneralStage<OUT>> OUT_STAGE build(@Nonnull AggregateOperation<A, R> aggrOp, @Nonnull CreateOutStageFn<OUT, OUT_STAGE> createOutStageFn) {
AggregateOperation adaptedAggrOp = wDef != null ? ADAPT_TO_JET_EVENT.adaptAggregateOperation(aggrOp) : aggrOp;
List<Transform> upstreamTransforms = toList(upstreamStages, s -> ((AbstractStage) s).transform);
final AbstractTransform transform;
if (wDef != null) {
transform = new WindowAggregateTransform<>(upstreamTransforms, wDef, adaptedAggrOp);
} else {
transform = new AggregateTransform<>(upstreamTransforms, adaptedAggrOp);
}
OUT_STAGE attached = createOutStageFn.get(transform, ADAPT_TO_JET_EVENT, pipelineImpl);
pipelineImpl.connectGeneralStages(upstreamStages, transform);
return attached;
}
use of com.hazelcast.jet.impl.pipeline.transform.WindowAggregateTransform in project hazelcast-jet by hazelcast.
the class AggBuilder method build.
@Nonnull
@SuppressWarnings("unchecked")
public <A, R, OUT, OUT_STAGE extends GeneralStage<OUT>> OUT_STAGE build(@Nonnull AggregateOperation<A, R> aggrOp, @Nonnull CreateOutStageFn<OUT, OUT_STAGE> createOutStageFn, @Nullable WindowResultFunction<? super R, ? extends OUT> mapToOutputFn) {
AggregateOperation adaptedAggrOp = wDef != null ? adaptAggregateOperation(aggrOp) : aggrOp;
List<Transform> upstreamTransforms = upstreamStages.stream().map(s -> ((AbstractStage) s).transform).collect(toList());
final Transform transform;
if (wDef != null) {
requireNonNull(mapToOutputFn, "wDef != null but mapToOutputFn == null");
transform = new WindowAggregateTransform<>(upstreamTransforms, wDef, adaptedAggrOp, mapToOutputFn);
} else {
transform = new AggregateTransform<>(upstreamTransforms, adaptedAggrOp);
}
OUT_STAGE attached = createOutStageFn.get(transform, DONT_ADAPT, pipelineImpl);
pipelineImpl.connect(upstreamTransforms, transform);
return attached;
}
Aggregations