Class JoinClause<K,T0,T1,T1_OUT>

java.lang.Object
com.hazelcast.jet.pipeline.JoinClause<K,T0,T1,T1_OUT>
Type Parameters:
K - the type of the join key
T0 - the type of the left-hand stream item
T1 - the type of the right-hand stream item
T1_OUT - the result type of the right-hand projection function
All Implemented Interfaces:
Serializable

public final class JoinClause<K,T0,T1,T1_OUT> extends Object implements Serializable
Specifies how to join an enriching stream to the primary stream in a hash-join operation. It holds three primitives:
  1. left-hand key extractor: extracts the join key from the primary stream
  2. right-hand key extractor: extracts the join key from the enriching stream
  3. right-hand projection function: maps the enriching stream item to the item that will be in the result of the join operation.
The primary use case for the projection function is enrichment from a map source, such as Sources.map(java.lang.String). The enriching stream consists of map entries, but the result should contain just the values. In this case the projection function should be Entry::getValue. There is direct support for this case with the method joinMapEntries(FunctionEx).
Since:
Jet 3.0
See Also:
  • Method Details

    • onKeys

      public static <K, T0, T1> JoinClause<K,T0,T1,T1> onKeys(FunctionEx<? super T0,? extends K> leftKeyFn, FunctionEx<? super T1,? extends K> rightKeyFn)
      Constructs and returns a join clause with the supplied left-hand and right-hand key extractor functions, and with an identity right-hand projection function.

      The given functions must be stateless and cooperative.

    • joinMapEntries

      public static <K, T0, T1_OUT> JoinClause<K,T0,Map.Entry<K,T1_OUT>,T1_OUT> joinMapEntries(FunctionEx<? super T0,? extends K> leftKeyFn)
      A shorthand factory for the common case of hash-joining with a stream of map entries. The right key extractor is Map.Entry::getKey and the right-hand projection function is Map.Entry::getValue.
      Type Parameters:
      K - the type of the key
      T0 - the type of the primary stream
      T1_OUT - the type of the enriching stream's entry value
      Parameters:
      leftKeyFn - the function to extract the key from the primary stream. It must be stateless and cooperative.
    • projecting

      public <T1_NEW_OUT> JoinClause<K,T0,T1,T1_NEW_OUT> projecting(FunctionEx<? super T1,? extends T1_NEW_OUT> rightProjectFn)
      Returns a copy of this join clause, but with the right-hand projection function replaced with the supplied one.

      The given function must be stateless and cooperative.

    • leftKeyFn

      public FunctionEx<? super T0,? extends K> leftKeyFn()
      Returns the left-hand key extractor function.
    • rightKeyFn

      public FunctionEx<? super T1,? extends K> rightKeyFn()
      Returns the right-hand key extractor function.
    • rightProjectFn

      public FunctionEx<? super T1,? extends T1_OUT> rightProjectFn()
      Returns the right-hand projection function.