Class AttributeBasedJoinKeyExtractor

    • 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 of AttributeBasedJoinKeyExtractor.ConditionAttributeRef where 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: JoinKeyExtractor
        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.

        Specified by:
        getJoinKey in interface JoinKeyExtractor
        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 RowData representing 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: JoinKeyExtractor
        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.

        Specified by:
        getLeftSideJoinKey in interface JoinKeyExtractor
        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 RowData representing 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: JoinKeyExtractor
        Returns the type of the join key for a given input.
        Specified by:
        getJoinKeyType in interface JoinKeyExtractor
        Parameters:
        inputId - The ID of the input stream.
        Returns:
        The RowType of the join key.
      • getJoinKeyIndices

        public int[] getJoinKeyIndices​(int inputId)
        Description copied from interface: JoinKeyExtractor
        Gets the field indices in the source row that make up the join key for a given input.
        Specified by:
        getJoinKeyIndices in interface JoinKeyExtractor
        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: JoinKeyExtractor
        Gets the type information for the common join key.
        Specified by:
        getCommonJoinKeyType in interface JoinKeyExtractor
        Returns:
        The RowType for 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: JoinKeyExtractor
        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.
        Specified by:
        getCommonJoinKey in interface JoinKeyExtractor
        Parameters:
        row - The input row.
        inputId - The ID of the input stream this row belongs to.
        Returns:
        A RowData representing 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: JoinKeyExtractor
        Gets the field indices in the source row that make up the common join key for a given input.
        Specified by:
        getCommonJoinKeyIndices in interface JoinKeyExtractor
        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.