/** * Returns a {@link PTransform} identical to this, but that uses an intermediate node to combine * parts of the data to reduce load on the final global combine step. * * <p>The {@code fanout} parameter determines the number of intermediate keys that will be used. */ public Globally<InputT, OutputT> withFanout(int fanout) { return new Globally<>(fn, fnDisplayData, insertDefault, fanout, sideInputs); }
/** * Returns a {@link PTransform} identical to this, but that does not attempt to provide a * default value in the case of empty input. Required when the input is not globally windowed * and the output is not being used as a side input. */ public Globally<InputT, OutputT> withoutDefaults() { return new Globally<>(fn, fnDisplayData, false, fanout, sideInputs); }
private static <InputT, OutputT> Globally<InputT, OutputT> globally( GlobalCombineFn<? super InputT, ?, OutputT> fn, DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) { return new Globally<>(fn, fnDisplayData, true, 0, ImmutableList.of()); }
/** * Returns a {@link PTransform} identical to this, but with the specified side inputs to use in * {@link CombineFnWithContext}. */ public Globally<InputT, OutputT> withSideInputs( Iterable<? extends PCollectionView<?>> sideInputs) { checkState(fn instanceof RequiresContextInternal); return new Globally<>( fn, fnDisplayData, insertDefault, fanout, ImmutableList.copyOf(sideInputs)); }