public class DataSetSessionWindowAggregatePreProcessor extends AbstractRichFunction implements MapPartitionFunction<Row,Row>, GroupCombineFunction<Row,Row>, ResultTypeQueryable<Row>, Compiler<GeneratedAggregations>, Logging
GroupCombineOperator
.
param: genAggregations Code-generated GeneratedAggregations
param: keysAndAggregatesArity The total arity of keys and aggregates
param: gap Session time window gap.
param: intermediateRowType Intermediate row data type.
Constructor and Description |
---|
DataSetSessionWindowAggregatePreProcessor(GeneratedAggregationsFunction genAggregations,
int keysAndAggregatesArity,
long gap,
TypeInformation<Row> intermediateRowType) |
Modifier and Type | Method and Description |
---|---|
void |
combine(Iterable<Row> records,
Collector<Row> out)
For sub-grouped intermediate aggregate Rows, divide window based on the rowtime
(current'rowtime - previous’rowtime > gap), and then merge data (within a unified window)
into an aggregate buffer.
|
void |
doCollect(Collector<Row> out,
long windowStart,
long windowEnd)
Emit the merged data of the current window.
|
TypeInformation<Row> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
TypeInformation<Row> |
intermediateRowType() |
void |
mapPartition(Iterable<Row> records,
Collector<Row> out)
Divide window based on the rowtime
(current'rowtime - previous’rowtime > gap), and then merge data (within a unified window)
into an aggregate buffer.
|
void |
open(Configuration config)
Initialization method for the function.
|
close, getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
public DataSetSessionWindowAggregatePreProcessor(GeneratedAggregationsFunction genAggregations, int keysAndAggregatesArity, long gap, TypeInformation<Row> intermediateRowType)
public TypeInformation<Row> intermediateRowType()
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 combine(Iterable<Row> records, Collector<Row> out)
combine
in interface GroupCombineFunction<Row,Row>
records
- Sub-grouped intermediate aggregate Rows.out
- (undocumented)public void mapPartition(Iterable<Row> records, Collector<Row> out)
mapPartition
in interface MapPartitionFunction<Row,Row>
records
- Intermediate aggregate Rows.out
- (undocumented)public void doCollect(Collector<Row> out, long windowStart, long windowEnd)
out
- the collection of the aggregate resultswindowStart
- the window's start attribute value is the min (rowtime)
of all rows in the window.windowEnd
- the window's end property value is max (rowtime) + gap
for all rows in the window.public TypeInformation<Row> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<Row>
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.