java.lang.Object
org.apache.beam.sdk.extensions.joinlibrary.Join

public class Join extends Object
Utility class with different versions of joins. All methods join two collections of key/value pairs (KV).
  • Constructor Details

    • Join

      public Join()
  • Method Details

    • innerJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> innerJoin(PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection)
      Inner join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2.
    • innerJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> innerJoin(String name, PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection)
      Inner join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      name - Name of the PTransform.
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2.
    • leftOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> leftOuterJoin(String name, PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V2 nullValue)
      Left Outer Join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      name - Name of the PTransform.
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      nullValue - Value to use as null value when right side do not match left side.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2. Values that should be null or empty is replaced with nullValue.
    • leftOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> leftOuterJoin(PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V2 nullValue)
    • rightOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> rightOuterJoin(String name, PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V1 nullValue)
      Right Outer Join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      name - Name of the PTransform.
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      nullValue - Value to use as null value when left side do not match right side.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2. Values that should be null or empty is replaced with nullValue.
    • rightOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> rightOuterJoin(PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V1 nullValue)
      Right Outer Join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      nullValue - Value to use as null value when left side do not match right side.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2. Values that should be null or empty is replaced with nullValue.
    • fullOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> fullOuterJoin(String name, PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V1 leftNullValue, V2 rightNullValue)
      Full Outer Join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      name - Name of the PTransform.
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      leftNullValue - Value to use as null value when left side do not match right side.
      rightNullValue - Value to use as null value when right side do not match right side.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2. Values that should be null or empty is replaced with leftNullValue/rightNullValue.
    • fullOuterJoin

      public static <K, V1, V2> PCollection<KV<K,KV<V1,V2>>> fullOuterJoin(PCollection<KV<K,V1>> leftCollection, PCollection<KV<K,V2>> rightCollection, V1 leftNullValue, V2 rightNullValue)
      Full Outer Join of two collections of KV elements.
      Type Parameters:
      K - Type of the key for both collections
      V1 - Type of the values for the left collection.
      V2 - Type of the values for the right collection.
      Parameters:
      leftCollection - Left side collection to join.
      rightCollection - Right side collection to join.
      leftNullValue - Value to use as null value when left side do not match right side.
      rightNullValue - Value to use as null value when right side do not match right side.
      Returns:
      A joined collection of KV where Key is the key and value is a KV where Key is of type V1 and Value is type V2. Values that should be null or empty is replaced with leftNullValue/rightNullValue.