T
- the data type wrapped in ElementWithRandom as input.@Internal public class SampleInCoordinator<T> extends Object implements GroupReduceFunction<IntermediateSampleData<T>,T>
Constructor and Description |
---|
SampleInCoordinator(boolean withReplacement,
int numSample,
long seed)
Create a function instance of SampleInCoordinator.
|
Modifier and Type | Method and Description |
---|---|
void |
reduce(Iterable<IntermediateSampleData<T>> values,
Collector<T> out)
The reduce method.
|
public SampleInCoordinator(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 reduce(Iterable<IntermediateSampleData<T>> values, Collector<T> out) throws Exception
GroupReduceFunction
reduce
in interface GroupReduceFunction<IntermediateSampleData<T>,T>
values
- All records that belong to the given input key.out
- 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.