Class AttributeBasedJoinKeyExtractor
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.join.stream.keyselector.AttributeBasedJoinKeyExtractor
-
- All Implemented Interfaces:
Serializable,JoinKeyExtractor
public class AttributeBasedJoinKeyExtractor extends Object implements JoinKeyExtractor, Serializable
AJoinKeyExtractorthat derives keys based onAttributeBasedJoinKeyExtractor.AttributeRefmappings provided injoinAttributeMap. It defines how attributes from different input streams are related through equi-join conditions, assuming input 0 is the base and subsequent inputs join to preceding ones.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAttributeBasedJoinKeyExtractor.AttributeRefReference to a specific field (fieldIndex) within a specific input stream (inputId).static classAttributeBasedJoinKeyExtractor.ConditionAttributeRefReference to a specific field (fieldIndex) within a specific input stream (inputId).
-
Constructor Summary
Constructors Constructor Description AttributeBasedJoinKeyExtractor(Map<Integer,List<AttributeBasedJoinKeyExtractor.ConditionAttributeRef>> joinAttributeMap, List<org.apache.flink.table.types.logical.RowType> inputTypes)Creates an AttributeBasedJoinKeyExtractor.
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
AttributeBasedJoinKeyExtractor
public AttributeBasedJoinKeyExtractor(Map<Integer,List<AttributeBasedJoinKeyExtractor.ConditionAttributeRef>> joinAttributeMap, List<org.apache.flink.table.types.logical.RowType> inputTypes)
Creates an AttributeBasedJoinKeyExtractor.- Parameters:
joinAttributeMap- Map defining equi-join conditions. Outer key: inputId (>= 1). The value is a list ofAttributeBasedJoinKeyExtractor.ConditionAttributeRefwhere each element defines an equi-join condition between a previous input (`leftInputId`, `leftFieldIndex`) and the current input (`rightInputId`, `rightFieldIndex`).inputTypes- Type information for all input streams (indexed 0 to N-1).
-
-
Method Detail
-
getJoinKey
public org.apache.flink.table.data.RowData getJoinKey(org.apache.flink.table.data.RowData row, int inputId)Description copied from interface:JoinKeyExtractorExtracts 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.
- Specified by:
getJoinKeyin interfaceJoinKeyExtractor- 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
public org.apache.flink.table.data.RowData getLeftSideJoinKey(int depth, org.apache.flink.table.data.RowData joinedRowData)Description copied from interface:JoinKeyExtractorExtracts 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.
- Specified by:
getLeftSideJoinKeyin interfaceJoinKeyExtractor- 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 public org.apache.flink.table.types.logical.RowType getJoinKeyType(int inputId)
Description copied from interface:JoinKeyExtractorReturns the type of the join key for a given input.- Specified by:
getJoinKeyTypein interfaceJoinKeyExtractor- Parameters:
inputId- The ID of the input stream.- Returns:
- The
RowTypeof the join key.
-
getJoinKeyIndices
public int[] getJoinKeyIndices(int inputId)
Description copied from interface:JoinKeyExtractorGets the field indices in the source row that make up the join key for a given input.- Specified by:
getJoinKeyIndicesin interfaceJoinKeyExtractor- 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.
-
getCommonJoinKeyType
public org.apache.flink.table.types.logical.RowType getCommonJoinKeyType()
Description copied from interface:JoinKeyExtractorGets the type information for the common join key.- Specified by:
getCommonJoinKeyTypein interfaceJoinKeyExtractor- Returns:
- The
RowTypefor the common key join type.
-
getCommonJoinKey
@Nullable public org.apache.flink.table.data.RowData getCommonJoinKey(org.apache.flink.table.data.RowData row, int inputId)Description copied from interface:JoinKeyExtractorExtracts 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.- Specified by:
getCommonJoinKeyin interfaceJoinKeyExtractor- 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.
-
getCommonJoinKeyIndices
public int[] getCommonJoinKeyIndices(int inputId)
Description copied from interface:JoinKeyExtractorGets the field indices in the source row that make up the common join key for a given input.- Specified by:
getCommonJoinKeyIndicesin interfaceJoinKeyExtractor- 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.
-
-