T
- @Internal public class SampleWithFraction<T> extends RichMapPartitionFunction<T,T>
Constructor and Description |
---|
SampleWithFraction(boolean withReplacement,
double fraction,
long seed)
Create a function instance of SampleWithFraction.
|
Modifier and Type | Method and Description |
---|---|
void |
mapPartition(Iterable<T> values,
Collector<T> out)
A user-implemented function that modifies or transforms an incoming object.
|
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
public SampleWithFraction(boolean withReplacement, double fraction, long seed)
withReplacement
- Whether element can be selected more than once.fraction
- Probability that each element is selected.seed
- random number generator seed.public void mapPartition(Iterable<T> values, Collector<T> out) throws Exception
MapPartitionFunction
mapPartition
in interface MapPartitionFunction<T,T>
mapPartition
in class RichMapPartitionFunction<T,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.