@NotThreadSafe public class PrecombineGroupingTable<K,InputT,AccumT> extends java.lang.Object implements Cache.Shrinkable<PrecombineGroupingTable<K,InputT,AccumT>>, org.apache.beam.sdk.util.Weighted
NotThreadSafe because the caller must use the bundle processing thread when invoking
put(org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K, InputT>>, org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K, AccumT>>>) and flush(org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K, AccumT>>>). shrink() may be called from any thread.
| Modifier and Type | Class and Description |
|---|---|
static interface |
PrecombineGroupingTable.SizeEstimator
Provides client-specific operations for size estimates.
|
| Modifier and Type | Method and Description |
|---|---|
static <K,InputT,AccumT> |
combining(org.apache.beam.sdk.options.PipelineOptions options,
Cache<java.lang.Object,java.lang.Object> cache,
org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,AccumT,?> combineFn,
org.apache.beam.sdk.coders.Coder<K> keyCoder,
boolean isGloballyWindowed)
Returns a grouping table that combines inputs into an accumulator.
|
static <K,InputT,AccumT> |
combiningAndSampling(org.apache.beam.sdk.options.PipelineOptions options,
Cache<java.lang.Object,java.lang.Object> cache,
org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,AccumT,?> combineFn,
org.apache.beam.sdk.coders.Coder<K> keyCoder,
double sizeEstimatorSampleRate,
boolean isGloballyWindowed)
Returns a grouping table that combines inputs into an accumulator with sampling
SizeEstimators. |
void |
flush(org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,AccumT>>> receiver)
Flushes all entries in this table to output.
|
long |
getWeight() |
void |
put(org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,InputT>> value,
org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,AccumT>>> receiver)
Adds the key and value to this table, possibly flushing some entries to output if the table is
full.
|
PrecombineGroupingTable<K,InputT,AccumT> |
shrink()
Returns a new object that is smaller than the object being evicted.
|
public static <K,InputT,AccumT> PrecombineGroupingTable<K,InputT,AccumT> combining(org.apache.beam.sdk.options.PipelineOptions options, Cache<java.lang.Object,java.lang.Object> cache, org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,AccumT,?> combineFn, org.apache.beam.sdk.coders.Coder<K> keyCoder, boolean isGloballyWindowed)
public static <K,InputT,AccumT> PrecombineGroupingTable<K,InputT,AccumT> combiningAndSampling(org.apache.beam.sdk.options.PipelineOptions options, Cache<java.lang.Object,java.lang.Object> cache, org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,AccumT,?> combineFn, org.apache.beam.sdk.coders.Coder<K> keyCoder, double sizeEstimatorSampleRate, boolean isGloballyWindowed)
SizeEstimators. The grouping table uses the cache to defer flushing output until
the cache evicts the table.@Nullable public PrecombineGroupingTable<K,InputT,AccumT> shrink()
Cache.ShrinkableIt is recommended to return an object that is at most half as large as the one being
evicted. If null is returned then the object will be evicted.
shrink in interface Cache.Shrinkable<PrecombineGroupingTable<K,InputT,AccumT>>public long getWeight()
getWeight in interface org.apache.beam.sdk.util.Weightedpublic void put(org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,InputT>> value, org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,AccumT>>> receiver) throws java.lang.Exception
java.lang.Exception