Class AppendOnlyTopNHelper

    • Constructor Detail

      • AppendOnlyTopNHelper

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

      • 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