use of com.hazelcast.jet.impl.pipeline.transform.AbstractTransform in project hazelcast by hazelcast.
the class GrAggBuilder method buildStream.
public <A, R> StreamStage<KeyedWindowResult<K, R>> buildStream(@Nonnull AggregateOperation<A, ? extends R> aggrOp) {
List<Transform> upstreamTransforms = toList(upstreamStages, s -> s.transform);
FunctionAdapter fnAdapter = ADAPT_TO_JET_EVENT;
// Casts in this expression are a workaround for JDK 8 compiler bug:
@SuppressWarnings("unchecked") List<FunctionEx<?, ? extends K>> adaptedKeyFns = toList(keyFns, fn -> fnAdapter.adaptKeyFn((FunctionEx) fn));
AbstractTransform transform = new WindowGroupTransform<K, R>(upstreamTransforms, wDef, adaptedKeyFns, fnAdapter.adaptAggregateOperation(aggrOp));
pipelineImpl.connect(upstreamStages, transform);
return new StreamStageImpl<>(transform, fnAdapter, pipelineImpl);
}
use of com.hazelcast.jet.impl.pipeline.transform.AbstractTransform in project hazelcast by hazelcast.
the class GrAggBuilder method buildBatch.
public <A, R, OUT> BatchStage<OUT> buildBatch(@Nonnull AggregateOperation<A, ? extends R> aggrOp, @Nonnull BiFunctionEx<? super K, ? super R, OUT> mapToOutputFn) {
checkSerializable(mapToOutputFn, "mapToOutputFn");
List<Transform> upstreamTransforms = toList(upstreamStages, s -> s.transform);
AbstractTransform transform = new GroupTransform<>(upstreamTransforms, keyFns, aggrOp, mapToOutputFn);
pipelineImpl.connect(upstreamStages, transform);
return new BatchStageImpl<>(transform, pipelineImpl);
}
use of com.hazelcast.jet.impl.pipeline.transform.AbstractTransform 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;
}
Aggregations