Interface JoinKeyExtractor
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AttributeBasedJoinKeyExtractor
public interface JoinKeyExtractor extends Serializable
Defines the strategy for extracting keys used for state management within theStreamingMultiJoinOperator.Implementations define how to derive keys for storing state records and for looking up matching records in state during the join process.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.flink.table.data.RowDatagetCommonJoinKey(org.apache.flink.table.data.RowData row, int inputId)Extracts the common key from an input row.int[]getCommonJoinKeyIndices(int inputId)Gets the field indices in the source row that make up the common join key for a given input.org.apache.flink.table.types.logical.RowTypegetCommonJoinKeyType()Gets the type information for the common join key.org.apache.flink.table.data.RowDatagetJoinKey(org.apache.flink.table.data.RowData row, int inputId)Extracts the key used for storing the input record in its corresponding state view.int[]getJoinKeyIndices(int inputId)Gets the field indices in the source row that make up the join key for a given input.org.apache.flink.table.types.logical.RowTypegetJoinKeyType(int inputId)Returns the type of the join key for a given input.org.apache.flink.table.data.RowDatagetLeftSideJoinKey(int depth, org.apache.flink.table.data.RowData joinedRowData)Extracts the key used for looking up matching records in the state of a specific input depth, based on the rows accumulated from previous inputs.voidrequiresKeyDeepCopy()Enables copying of row data.
-
-
-
Method Detail
-
getJoinKey
org.apache.flink.table.data.RowData getJoinKey(org.apache.flink.table.data.RowData row, int inputId)Extracts the key used for storing the input record in its corresponding state view.This key determines how records from a specific input stream are organized within their state.
- Parameters:
row- The input row for which to extract the storage key.inputId- The ID (0-based index) of the input stream this row belongs to.- Returns:
- A
RowDatarepresenting the state storage key. Can be null if no key can be derived (e.g., missing configuration).
-
getLeftSideJoinKey
org.apache.flink.table.data.RowData getLeftSideJoinKey(int depth, org.apache.flink.table.data.RowData joinedRowData)Extracts the key used for looking up matching records in the state of a specific input depth, based on the rows accumulated from previous inputs.When processing the join recursively at a certain `depth`, this key is used to query the state associated with that `depth` (i.e., the state for input `depth`) to find potential join partners.
- Parameters:
depth- The current processing depth (0-based index), representing the target input ID for state lookup.joinedRowData- JoinedRowData with rows accumulated so far in the current recursive join path.- Returns:
- A
RowDatarepresenting the state lookup key. Can be null if no key can be derived (e.g., missing configuration, or a required row in `joinedRowData` is null).
-
getJoinKeyType
@Nullable org.apache.flink.table.types.logical.RowType getJoinKeyType(int inputId)
Returns the type of the join key for a given input.- Parameters:
inputId- The ID of the input stream.- Returns:
- The
RowTypeof the join key.
-
getJoinKeyIndices
int[] getJoinKeyIndices(int inputId)
Gets the field indices in the source row that make up the join key for a given input.- Parameters:
inputId- The ID of the input stream.- Returns:
- An array of integers representing the field indices in the source row that form the join key.
-
getCommonJoinKey
org.apache.flink.table.data.RowData getCommonJoinKey(org.apache.flink.table.data.RowData row, int inputId)Extracts the common key from an input row. The common key consists of attributes that are part of all equi-join conditions in the multi-join sequence.- Parameters:
row- The input row.inputId- The ID of the input stream this row belongs to.- Returns:
- A
RowDatarepresenting the common key, or a default key if no common attributes exist or cannot be determined for this input.
-
getCommonJoinKeyType
org.apache.flink.table.types.logical.RowType getCommonJoinKeyType()
Gets the type information for the common join key.- Returns:
- The
RowTypefor the common key join type.
-
getCommonJoinKeyIndices
int[] getCommonJoinKeyIndices(int inputId)
Gets the field indices in the source row that make up the common join key for a given input.- Parameters:
inputId- The ID of the input stream.- Returns:
- An array of integers representing the field indices in the source row that form the common join key.
-
requiresKeyDeepCopy
void requiresKeyDeepCopy()
Enables copying of row data.
-
-