Class SampleInPartition<T>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.api.common.functions.RichMapPartitionFunction<T,IntermediateSampleData<T>>
-
- org.apache.flink.api.java.functions.SampleInPartition<T>
-
- Type Parameters:
T- The type of input data
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.MapPartitionFunction<T,IntermediateSampleData<T>>,org.apache.flink.api.common.functions.RichFunction
@Internal public class SampleInPartition<T> extends org.apache.flink.api.common.functions.RichMapPartitionFunction<T,IntermediateSampleData<T>>
SampleInPartition wraps the sample logic on the partition side (the first phase of distributed sample algorithm). It executes the partition side sample logic in a mapPartition function.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SampleInPartition(boolean withReplacement, int numSample, long seed)Create a function instance of SampleInPartition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmapPartition(Iterable<T> values, org.apache.flink.util.Collector<IntermediateSampleData<T>> out)-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
-
-
-
-
Constructor Detail
-
SampleInPartition
public SampleInPartition(boolean withReplacement, int numSample, long seed)Create a function instance of SampleInPartition.- Parameters:
withReplacement- Whether element can be selected more than once.numSample- Fixed sample size.seed- Random generator seed.
-
-
Method Detail
-
mapPartition
public void mapPartition(Iterable<T> values, org.apache.flink.util.Collector<IntermediateSampleData<T>> out) throws Exception
- Specified by:
mapPartitionin interfaceorg.apache.flink.api.common.functions.MapPartitionFunction<T,IntermediateSampleData<T>>- Specified by:
mapPartitionin classorg.apache.flink.api.common.functions.RichMapPartitionFunction<T,IntermediateSampleData<T>>- Throws:
Exception
-
-