T
- Type of the input elements.O
- Type of the returned elements.@Public @FunctionalInterface public interface MapPartitionFunction<T,O> extends Function, Serializable
This function is intended to provide enhanced flexibility in the processing of elements in a partition.
For most of the simple use cases, consider using the MapFunction
or FlatMapFunction
.
The basic syntax for a MapPartitionFunction is as follows:
DataSet<X> input = ...;
DataSet<Y> result = input.mapPartition(new MyMapPartitionFunction());
Modifier and Type | Method and Description |
---|---|
void |
mapPartition(Iterable<T> values,
Collector<O> out)
A user-implemented function that modifies or transforms an incoming object.
|
void mapPartition(Iterable<T> values, Collector<O> out) throws Exception
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–2020 The Apache Software Foundation. All rights reserved.