T
- The type of input data@Internal public class SampleInPartition<T> extends RichMapPartitionFunction<T,IntermediateSampleData<T>>
Constructor and Description |
---|
SampleInPartition(boolean withReplacement,
int numSample,
long seed)
Create a function instance of SampleInPartition.
|
Modifier and Type | Method and Description |
---|---|
void |
mapPartition(Iterable<T> values,
Collector<IntermediateSampleData<T>> out)
A user-implemented function that modifies or transforms an incoming object.
|
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
public SampleInPartition(boolean withReplacement, int numSample, long seed)
withReplacement
- Whether element can be selected more than once.numSample
- Fixed sample size.seed
- Random generator seed.public void mapPartition(Iterable<T> values, Collector<IntermediateSampleData<T>> out) throws Exception
MapPartitionFunction
mapPartition
in interface MapPartitionFunction<T,IntermediateSampleData<T>>
mapPartition
in class RichMapPartitionFunction<T,IntermediateSampleData<T>>
values
- All records for the mapperout
- The collector to hand results to.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.