Class BufferBundle<T>
- 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
ABufferBundleis 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 theJoinInputSideSpec.
-
-
Field Summary
Fields Modifier and Type Field Description protected intactualSizeprotected Map<org.apache.flink.table.data.RowData,T>bundleprotected intcount
-
Constructor Summary
Constructors Constructor Description BufferBundle()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intaddRecord(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.voidclear()Clear this bufferBundle.Set<org.apache.flink.table.data.RowData>getJoinKeys()Get the joinKeys in bufferBundle.abstract Map<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>>getRecords()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.booleanisEmpty()Check if this bufferBundle is empty.intreducedSize()Return the number of reduced records.
-
-
-
Method Detail
-
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
-
-