public final class TopNRecordsCombiner extends Object implements RecordsCombiner
RecordsCombiner that save topN records of incremental input records
into the window state.| Modifier and Type | Class and Description |
|---|---|
static class |
TopNRecordsCombiner.Factory
Factory to create
TopNRecordsCombiner. |
RecordsCombiner.LocalFactory| Constructor and Description |
|---|
TopNRecordsCombiner(WindowTimerService<Long> timerService,
StateKeyContext keyContext,
WindowMapState<Long,List<org.apache.flink.table.data.RowData>> dataState,
Comparator<org.apache.flink.table.data.RowData> sortKeyComparator,
org.apache.flink.api.java.functions.KeySelector<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData> sortKeySelector,
long topN,
org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> recordSerializer,
boolean isEventTime) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release resources allocated by this combine function.
|
void |
combine(WindowKey windowKey,
Iterator<org.apache.flink.table.data.RowData> records)
Combines the buffered data into state based on the given window-key pair.
|
public TopNRecordsCombiner(WindowTimerService<Long> timerService, StateKeyContext keyContext, WindowMapState<Long,List<org.apache.flink.table.data.RowData>> dataState, Comparator<org.apache.flink.table.data.RowData> sortKeyComparator, org.apache.flink.api.java.functions.KeySelector<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData> sortKeySelector, long topN, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> recordSerializer, boolean isEventTime)
public void combine(WindowKey windowKey, Iterator<org.apache.flink.table.data.RowData> records) throws Exception
RecordsCombinercombine in interface RecordsCombinerwindowKey - the window-key pair that the buffered data belong to, the window-key object
is reused.records - the buffered data, the iterator and RowData objects are reused.Exceptionpublic void close()
throws Exception
RecordsCombinerclose in interface RecordsCombinerExceptionCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.