T - the type of the elementspublic static class Sample.FixedSizedSampleFn<T> extends Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>
CombineFn that computes a fixed-size sample of a
collection of values.| Modifier and Type | Method and Description |
|---|---|
void |
addInput(com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap accumulator,
T input)
Adds the given input value to the given accumulator,
modifying the accumulator.
|
com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
java.lang.Iterable<T> |
extractOutput(com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap accumulator)
Returns the output value that is the result of combining all
the input values represented by the given accumulator.
|
Coder<com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap> |
getAccumulatorCoder(CoderRegistry registry,
Coder<T> inputCoder)
Returns the
Coder to use for accumulator VA
values, or null if it is not able to be inferred. |
Coder<java.lang.Iterable<T>> |
getDefaultOutputCoder(CoderRegistry registry,
Coder<T> inputCoder)
Returns the
Coder to use by default for output
VO values, or null if it is not able to be inferred. |
com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap |
mergeAccumulators(java.lang.Iterable<com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap> accumulators)
Returns an accumulator representing the accumulation of all the
input values accumulated in the merging accumulators.
|
apply, asKeyedFnpublic com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>public void addInput(com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap accumulator,
T input)
Combine.CombineFnaddInput in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>public com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap mergeAccumulators(java.lang.Iterable<com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap> accumulators)
Combine.CombineFnMay modify any of the argument accumulators. May return a fresh accumulator, or may return one of the (modified) argument accumulators.
mergeAccumulators in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>public java.lang.Iterable<T> extractOutput(com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap accumulator)
Combine.CombineFnextractOutput in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>public Coder<com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap> getAccumulatorCoder(CoderRegistry registry, Coder<T> inputCoder)
Combine.CombineFnCoder to use for accumulator VA
values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being used
for VI values and the enclosing Pipeline's
CoderRegistry to try to infer the Coder for VA
values.
This is the Coder used to send data through a communication-intensive shuffle step, so a compact and efficient representation may have significant performance benefits.
getAccumulatorCoder in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>public Coder<java.lang.Iterable<T>> getDefaultOutputCoder(CoderRegistry registry, Coder<T> inputCoder)
Combine.CombineFnCoder to use by default for output
VO values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being
used for input VI values and the enclosing
Pipeline's CoderRegistry to try to infer the
Coder for VO values.
getDefaultOutputCoder in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.TopCombineFn.Heap,java.lang.Iterable<T>>