Package org.apache.beam.fn.harness
Class PrecombineGroupingTable<K,InputT,AccumT>
- java.lang.Object
-
- org.apache.beam.fn.harness.PrecombineGroupingTable<K,InputT,AccumT>
-
- All Implemented Interfaces:
Cache.Shrinkable<PrecombineGroupingTable<K,InputT,AccumT>>,org.apache.beam.sdk.util.Weighted
@NotThreadSafe public class PrecombineGroupingTable<K,InputT,AccumT> extends java.lang.Object implements Cache.Shrinkable<PrecombineGroupingTable<K,InputT,AccumT>>, org.apache.beam.sdk.util.Weighted
Static utility methods that provide a grouping table implementation.NotThreadSafebecause the caller must use the bundle processing thread when invokingput(org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K, InputT>>, org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K, AccumT>>>)andflush(org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K, AccumT>>>).shrink()may be called from any thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePrecombineGroupingTable.SizeEstimatorProvides client-specific operations for size estimates.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)Returns a grouping table that combines inputs into an accumulator.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)Returns a grouping table that combines inputs into an accumulator with samplingSizeEstimators.voidflush(org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K,AccumT>>> receiver)Flushes all entries in this table to output.longgetWeight()voidput(org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K,InputT>> value, org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.values.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.
-
-
-
Method Detail
-
combining
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)
Returns a grouping table that combines inputs into an accumulator. The grouping table uses the cache to defer flushing output until the cache evicts the table.
-
combiningAndSampling
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)
Returns a grouping table that combines inputs into an accumulator with samplingSizeEstimators. The grouping table uses the cache to defer flushing output until the cache evicts the table.
-
shrink
@Nullable public PrecombineGroupingTable<K,InputT,AccumT> shrink()
Description copied from interface:Cache.ShrinkableReturns a new object that is smaller than the object being evicted.It is recommended to return an object that is at most half as large as the one being evicted. If
nullis returned then the object will be evicted.- Specified by:
shrinkin interfaceCache.Shrinkable<K>
-
getWeight
public long getWeight()
- Specified by:
getWeightin interfaceorg.apache.beam.sdk.util.Weighted
-
put
public void put(org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K,InputT>> value, org.apache.beam.sdk.fn.data.FnDataReceiver<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.KV<K,AccumT>>> receiver) throws java.lang.Exception
Adds the key and value to this table, possibly flushing some entries to output if the table is full.- Throws:
java.lang.Exception
-
-