Interface WindowBuffer

  • All Known Implementing Classes:
    RecordsWindowBuffer

    @Internal
    public interface WindowBuffer
    A buffer that buffers data in memory and flushes many values to state together at a time to avoid frequently accessing state, or flushes to output to reduce shuffling data.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addElement​(org.apache.flink.table.data.RowData key, long window, org.apache.flink.table.data.RowData element)
      Adds an element with associated key into the buffer.
      void advanceProgress​(long progress)
      Advances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.
      void close()
      Release resources allocated by this buffer.
      void flush()
      Flushes all intermediate buffered data to the underlying backend or output stream.
    • Method Detail

      • addElement

        void addElement​(org.apache.flink.table.data.RowData key,
                        long window,
                        org.apache.flink.table.data.RowData element)
                 throws Exception
        Adds an element with associated key into the buffer. The buffer may temporarily buffer the element, or immediately write it to the stream.

        It may be that adding this element fills up an internal buffer and causes the buffer flushing of a batch of internally buffered elements.

        Parameters:
        key - the key associated with the element
        element - The element to add.
        Throws:
        Exception - Thrown, if the element cannot be added to the buffer, or if the flushing throws an exception.
      • advanceProgress

        void advanceProgress​(long progress)
                      throws Exception
        Advances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.

        This will potentially flush buffered data into states or to the output stream, because the watermark advancement may be in a very small step, but we don't need to flush buffered data for every watermark advancement.

        Parameters:
        progress - the current progress time
        Throws:
        Exception
      • flush

        void flush()
            throws Exception
        Flushes all intermediate buffered data to the underlying backend or output stream.
        Throws:
        Exception - Thrown if the buffer cannot be flushed, or if the output stream throws an exception.
      • close

        void close()
            throws Exception
        Release resources allocated by this buffer.
        Throws:
        Exception