java.lang.Object
org.apache.flink.table.runtime.operators.join.stream.bundle.BufferBundle<T>
Direct Known Subclasses:
InputSideHasNoUniqueKeyBundle, InputSideHasUniqueKeyBundle, JoinKeyContainsUniqueKeyBundle

public abstract class BufferBundle<T> extends Object
A BufferBundle is a bundle to buffer the input records in memory and fold data based on specified pattern to reduce state access. The bundle is used in MiniBatchStreamingJoinOperator. The structure of the bundle varies depending on the JoinInputSideSpec.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected final Map<org.apache.flink.table.data.RowData,T>
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    addRecord(org.apache.flink.table.data.RowData joinKey, org.apache.flink.table.data.RowData uniqueKey, org.apache.flink.table.data.RowData record)
    Adds a record into the bufferBundle when processing element in a stream and this function would return the size of the bufferBundle.
    void
    Clear this bufferBundle.
    Set<org.apache.flink.table.data.RowData>
    Get the joinKeys in bufferBundle.
    abstract Map<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>>
    Get records associated with joinKeys from bufferBundle.
    abstract Map<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>>
    getRecordsWithJoinKey(org.apache.flink.table.data.RowData joinKey)
    Get records associated with joinKeys from bufferBundle.
    boolean
    Check if this bufferBundle is empty.
    int
    Return the number of reduced records.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bundle

      protected final Map<org.apache.flink.table.data.RowData,T> bundle
    • count

      protected int count
    • actualSize

      protected int actualSize
  • Constructor Details

    • BufferBundle

      public BufferBundle()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Check if this bufferBundle is empty.
    • reducedSize

      public int reducedSize()
      Return the number of reduced records.
    • clear

      public void clear()
      Clear this bufferBundle.
    • getJoinKeys

      public Set<org.apache.flink.table.data.RowData> getJoinKeys()
      Get the joinKeys in bufferBundle. Whether to override this method is based on the implementing class.
    • addRecord

      public abstract int addRecord(org.apache.flink.table.data.RowData joinKey, @Nullable org.apache.flink.table.data.RowData uniqueKey, org.apache.flink.table.data.RowData record)
      Adds a record into the bufferBundle when processing element in a stream and this function would return the size of the bufferBundle.
      Parameters:
      joinKey - the joinKey associated with the record.
      uniqueKey - the uniqueKey associated with the record. This could be null.
      record - The record to add.
      Returns:
      number of processed by current bundle.
    • getRecords

      public abstract Map<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>> getRecords() throws Exception
      Get records associated with joinKeys from bufferBundle.
      Returns:
      a map whose key is joinKey and value is list of records.
      Throws:
      Exception
    • getRecordsWithJoinKey

      public abstract Map<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>> getRecordsWithJoinKey(org.apache.flink.table.data.RowData joinKey) throws Exception
      Get records associated with joinKeys from bufferBundle. And this function is different from getRecords() above where getRecords() returns a map whose key is joinKey and value is list of records.
      Parameters:
      joinKey - one of joinKeys stored in this bundle.
      Returns:
      a map whose key is uniqueKey and value is a list of records.
      Throws:
      Exception