public class AggregateReduceGroupFunction extends RichGroupReduceFunction<Row,Row>
GroupReduceOperator
.
Constructor and Description |
---|
AggregateReduceGroupFunction(Aggregate<?>[] aggregates,
scala.Tuple2<Object,Object>[] groupKeysMapping,
scala.Tuple2<Object,Object>[] aggregateMapping,
int intermediateRowArity) |
Modifier and Type | Method and Description |
---|---|
void |
open(Configuration config)
Initialization method for the function.
|
void |
reduce(Iterable<Row> records,
Collector<Row> out)
For grouped intermediate aggregate Rows, merge all of them into aggregate buffer,
calculate aggregated values output by aggregate buffer, and set them into output
Row based on the mapping relation between intermediate aggregate data and output data.
|
close, getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
public void open(Configuration config)
RichFunction
The configuration object passed to the function can be used for configuration and initialization. The configuration contains all parameters that were configured on the function in the program composition.
public class MyMapper extends FilterFunction<String> {
private String searchString;
public void open(Configuration parameters) {
this.searchString = parameters.getString("foo");
}
public boolean filter(String value) {
return value.equals(searchString);
}
}
By default, this method does nothing.
open
in interface RichFunction
open
in class AbstractRichFunction
config
- The configuration containing the parameters attached to the contract.Configuration
public void reduce(Iterable<Row> records, Collector<Row> out)
reduce
in interface GroupReduceFunction<Row,Row>
reduce
in class RichGroupReduceFunction<Row,Row>
records
- Grouped intermediate aggregate Rows iterator.out
- The collector to hand results to.
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.