public abstract class AbstractTopNFunction extends KeyedProcessFunctionWithCleanupState<BaseRow,BaseRow,BaseRow>
KeyedProcessFunction.Context, KeyedProcessFunction.OnTimerContext
Modifier and Type | Field and Description |
---|---|
protected long |
hitCount |
protected BaseRowTypeInfo |
inputRowType |
protected KeyContext |
keyContext |
protected boolean |
outputRankNumber |
protected long |
rankEnd |
protected long |
requestCount |
protected Comparator<BaseRow> |
sortKeyComparator |
protected KeySelector<BaseRow,BaseRow> |
sortKeySelector |
stateCleaningEnabled
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkSortKeyInBufferRange(BaseRow sortKey,
org.apache.flink.table.runtime.operators.rank.TopNBuffer buffer)
Checks whether the record should be put into the buffer.
|
protected void |
collect(Collector<BaseRow> out,
BaseRow inputRow) |
protected void |
collect(Collector<BaseRow> out,
BaseRow inputRow,
long rank) |
protected void |
delete(Collector<BaseRow> out,
BaseRow inputRow)
This is similar to [[retract()]] but always send retraction message regardless of generateRetraction is true or
not.
|
protected void |
delete(Collector<BaseRow> out,
BaseRow inputRow,
long rank)
This is with-row-number version of above delete() method.
|
protected long |
getDefaultTopNSize()
Gets default topN size.
|
protected boolean |
hasOffset() |
protected long |
initRankEnd(BaseRow row)
Initialize rank end.
|
protected boolean |
isInRankEnd(long rank) |
protected boolean |
isInRankRange(long rank) |
void |
open(Configuration parameters)
Initialization method for the function.
|
protected void |
registerMetric(long heapSize) |
protected void |
retract(Collector<BaseRow> out,
BaseRow inputRow,
long rank) |
void |
setKeyContext(KeyContext keyContext)
Sets keyContext to RankFunction.
|
cleanupState, initCleanupTimeState, isProcessingTimeTimer, needToCleanupState, registerProcessingCleanupTimer
onTimer, processElement
close, getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
registerProcessingCleanupTimer
protected Comparator<BaseRow> sortKeyComparator
protected final boolean outputRankNumber
protected final BaseRowTypeInfo inputRowType
protected final KeySelector<BaseRow,BaseRow> sortKeySelector
protected KeyContext keyContext
protected long rankEnd
protected long hitCount
protected long requestCount
public void open(Configuration parameters) throws Exception
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 MyFilter extends RichFilterFunction<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
parameters
- The configuration containing the parameters attached to the contract.Exception
- Implementations may forward exceptions, which are caught by the runtime. When the
runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.Configuration
protected long getDefaultTopNSize()
protected long initRankEnd(BaseRow row) throws Exception
row
- input recordException
protected boolean checkSortKeyInBufferRange(BaseRow sortKey, org.apache.flink.table.runtime.operators.rank.TopNBuffer buffer)
sortKey
- sortKey to testbuffer
- buffer to addprotected void registerMetric(long heapSize)
protected void delete(Collector<BaseRow> out, BaseRow inputRow)
protected void delete(Collector<BaseRow> out, BaseRow inputRow, long rank)
protected boolean isInRankEnd(long rank)
protected boolean isInRankRange(long rank)
protected boolean hasOffset()
public void setKeyContext(KeyContext keyContext)
keyContext
- keyContext of current function.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.