@SuppressWarnings("unchecked") public GrAggBuilder(BatchStageWithKey<?, K> stage0) { ComputeStageImplBase computeStage = ((StageWithGroupingBase) stage0).computeStage; pipelineImpl = (PipelineImpl) computeStage.getPipeline(); wDef = null; upstreamStages.add(computeStage); keyFns.add(stage0.keyFn()); }
@SuppressWarnings("unchecked") public <E> Tag<E> add(BatchStageWithKey<E, K> stage) { upstreamStages.add(((StageWithGroupingBase) stage).computeStage); keyFns.add(stage.keyFn()); return (Tag<E>) tag(upstreamStages.size() - 1); }
@Nonnull @Override public <T1, T2, R, OUT> BatchStage<OUT> aggregate3( @Nonnull BatchStageWithKey<T1, ? extends K> stage1, @Nonnull BatchStageWithKey<T2, ? extends K> stage2, @Nonnull AggregateOperation3<? super T, ? super T1, ? super T2, ?, R> aggrOp, @Nonnull DistributedBiFunction<? super K, ? super R, ? extends OUT> mapToOutputFn ) { checkSerializable(mapToOutputFn, "mapToOutputFn"); return computeStage.attach( new GroupTransform<>( asList(computeStage.transform, transformOf(stage1), transformOf(stage2)), asList(keyFn(), stage1.keyFn(), stage2.keyFn()), aggrOp, mapToOutputFn), DO_NOT_ADAPT); } }
@Nonnull @Override public <T1, R, OUT> BatchStage<OUT> aggregate2( @Nonnull BatchStageWithKey<T1, ? extends K> stage1, @Nonnull AggregateOperation2<? super T, ? super T1, ?, ? extends R> aggrOp, @Nonnull DistributedBiFunction<? super K, ? super R, ? extends OUT> mapToOutputFn ) { checkSerializable(mapToOutputFn, "mapToOutputFn"); return computeStage.attach( new GroupTransform<>( asList(computeStage.transform, transformOf(stage1)), asList(keyFn(), stage1.keyFn()), aggrOp, mapToOutputFn ), DO_NOT_ADAPT); }