Interface JoinFunction<IN1,​IN2,​OUT>

  • Type Parameters:
    IN1 - The type of the elements in the first input.
    IN2 - The type of the elements in the second input.
    OUT - The type of the result elements.
    All Superinterfaces:
    Function, Serializable
    All Known Implementing Classes:
    RichJoinFunction
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @Public
    @FunctionalInterface
    public interface JoinFunction<IN1,​IN2,​OUT>
    extends Function, Serializable
    Interface for Join functions. Joins combine two data sets by joining their elements on specified keys. This function is called with each pair of joining elements.

    By default, the joins follows strictly the semantics of an "inner join" in SQL. the semantics are those of an "inner join", meaning that elements are filtered out if their key is not contained in the other data set.

    The basic syntax for using Join on two data sets is as follows:

    
     DataSet<X> set1 = ...;
     DataSet<Y> set2 = ...;
    
     set1.join(set2).where(<key-definition>).equalTo(<key-definition>).with(new MyJoinFunction());
     

    set1 is here considered the first input, set2 the second input.

    The Join function is an optional part of a join operation. If no JoinFunction is provided, the result of the operation is a sequence of 2-tuples, where the elements in the tuple are those that the JoinFunction would have been invoked with.

    Note: You can use a CoGroupFunction to perform an outer join.

    • Method Detail

      • join

        OUT join​(IN1 first,
                 IN2 second)
          throws Exception
        The join method, called once per joined pair of elements.
        Parameters:
        first - The element from first input.
        second - The element from second input.
        Returns:
        The resulting element.
        Throws:
        Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.