Class AppendOnlyTopNHelper

java.lang.Object
org.apache.flink.table.runtime.operators.rank.AbstractTopNFunction.AbstractTopNHelper
org.apache.flink.table.runtime.operators.rank.utils.AppendOnlyTopNHelper

public abstract class AppendOnlyTopNHelper extends AbstractTopNFunction.AbstractTopNHelper
A helper to help do the logic 'Top-n' for append-only stream in AppendOnlyTopNFunction and AsyncStateAppendOnlyTopNFunction.
  • Constructor Details

    • AppendOnlyTopNHelper

      public AppendOnlyTopNHelper(AbstractTopNFunction topNFunction, long cacheSize, long topNSize)
  • Method Details

    • registerMetric

      public void registerMetric()
    • getTopNBufferFromCache

      @Nullable public TopNBuffer getTopNBufferFromCache(org.apache.flink.table.data.RowData currentKey)
    • saveTopNBufferToCache

      public void saveTopNBufferToCache(org.apache.flink.table.data.RowData currentKey, TopNBuffer topNBuffer)
    • processElementWithRowNumber

      public void processElementWithRowNumber(TopNBuffer buffer, org.apache.flink.table.data.RowData sortKey, org.apache.flink.table.data.RowData input, long rankEnd, org.apache.flink.util.Collector<org.apache.flink.table.data.RowData> out) throws Exception
      The without-number-algorithm can't handle topN with offset, so use the with-number-algorithm to handle offset.
      Throws:
      Exception
    • processElementWithoutRowNumber

      public void processElementWithoutRowNumber(TopNBuffer buffer, org.apache.flink.table.data.RowData input, long rankEnd, org.apache.flink.util.Collector<org.apache.flink.table.data.RowData> out) throws Exception
      Throws:
      Exception
    • removeFromState

      protected abstract void removeFromState(org.apache.flink.table.data.RowData key) throws Exception
      Throws:
      Exception
    • updateState

      protected abstract void updateState(org.apache.flink.table.data.RowData key, List<org.apache.flink.table.data.RowData> value) throws Exception
      Throws:
      Exception