T - 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) |
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContextpublic 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
mapPartition in interface MapPartitionFunction<T,T>mapPartition in class RichMapPartitionFunction<T,T>ExceptionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.