T - the type of the elementspublic static class Sample.FixedSizedSampleFn<T> extends Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>
CombineFn that computes a fixed-size sample of a
collection of values.| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> |
addInput(com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> accumulator,
T input)
Adds the given input value to the given accumulator, returning the
new accumulator value.
|
com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
Iterable<T> |
extractOutput(com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> 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.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>> |
getAccumulatorCoder(CoderRegistry registry,
Coder<T> inputCoder)
Returns the
Coder to use for accumulator AccumT
values, or null if it is not able to be inferred. |
Coder<Iterable<T>> |
getDefaultOutputCoder(CoderRegistry registry,
Coder<T> inputCoder)
Returns the
Coder to use by default for output
OutputT values, or null if it is not able to be inferred. |
com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> |
mergeAccumulators(Iterable<com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>> accumulators)
Returns an accumulator representing the accumulation of all the
input values accumulated in the merging accumulators.
|
apply, asKeyedFn, getOutputTypepublic com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>public com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> addInput(com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> accumulator, T input)
Combine.CombineFnFor efficiency, the input accumulator may be modified and returned.
public com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> mergeAccumulators(Iterable<com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>> 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.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>public Iterable<T> extractOutput(com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>> accumulator)
Combine.CombineFnextractOutput in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>public Coder<com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>> getAccumulatorCoder(CoderRegistry registry, Coder<T> inputCoder)
Combine.CombineFnCoder to use for accumulator AccumT
values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being used
for InputT values and the enclosing Pipeline's
CoderRegistry to try to infer the Coder for AccumT
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.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>public Coder<Iterable<T>> getDefaultOutputCoder(CoderRegistry registry, Coder<T> inputCoder)
Combine.CombineFnCoder to use by default for output
OutputT values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being
used for input InputT values and the enclosing
Pipeline's CoderRegistry to try to infer the
Coder for OutputT values.
getDefaultOutputCoder in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<KV<Integer,T>,SerializableComparator<KV<Integer,T>>>,Iterable<T>>