public static <K, InputT, AccumT, OutputT>
AppliedCombineFn<K, InputT, AccumT, OutputT> withInputCoder(
GlobalCombineFn<? super InputT, AccumT, OutputT> fn,
CoderRegistry registry,
KvCoder<K, InputT> kvCoder,
Iterable<PCollectionView<?>> sideInputViews,
WindowingStrategy<?, ?> windowingStrategy) {
@SuppressWarnings("unchecked")
GlobalCombineFn<InputT, AccumT, OutputT> clonedFn =
(GlobalCombineFn<InputT, AccumT, OutputT>) SerializableUtils.clone(fn);
try {
Coder<AccumT> accumulatorCoder =
clonedFn.getAccumulatorCoder(registry, kvCoder.getValueCoder());
return create(clonedFn, accumulatorCoder, sideInputViews, kvCoder, windowingStrategy);
} catch (CannotProvideCoderException e) {
throw new IllegalStateException("Could not determine coder for accumulator", e);
}
}