/** * <b>For internal use only; no backwards compatibility guarantees</b> * * <p>Identical to {@link #combining(CombineFnWithContext)}, but with an accumulator coder * explicitly supplied. * * <p>If automatic coder inference fails, use this method. */ @Internal public static <InputT, AccumT, OutputT> StateSpec<CombiningState<InputT, AccumT, OutputT>> combining( Coder<AccumT> accumCoder, CombineFnWithContext<InputT, AccumT, OutputT> combineFn) { return combiningInternal(accumCoder, combineFn); }
/** * Identical to {@link #combining(CombineFn)}, but with an accumulator coder explicitly supplied. * * <p>If automatic coder inference fails, use this method. */ public static <InputT, AccumT, OutputT> StateSpec<CombiningState<InputT, AccumT, OutputT>> combining( Coder<AccumT> accumCoder, CombineFn<InputT, AccumT, OutputT> combineFn) { checkArgument( accumCoder != null, "accumCoder should not be null. " + "Consider using combining(CombineFn<> combineFn) instead."); return combiningInternal(accumCoder, combineFn); }
/** * <b><i>For internal use only; no backwards-compatibility guarantees.</i></b> * * <p>Create a state spec for values that use a {@link CombineFn} to automatically merge multiple * {@code InputT}s into a single {@code OutputT}. * * <p>This determines the {@code Coder<AccumT>} from the given {@code Coder<InputT>}, and should * only be used to initialize static values. */ @Internal public static <InputT, AccumT, OutputT> StateSpec<CombiningState<InputT, AccumT, OutputT>> combiningFromInputInternal( Coder<InputT> inputCoder, CombineFn<InputT, AccumT, OutputT> combineFn) { try { Coder<AccumT> accumCoder = combineFn.getAccumulatorCoder(STANDARD_REGISTRY, inputCoder); return combiningInternal(accumCoder, combineFn); } catch (CannotProvideCoderException e) { throw new IllegalArgumentException( "Unable to determine accumulator coder for " + combineFn.getClass().getSimpleName() + " from " + inputCoder, e); } }