Interface CrossFunction<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:
    RichCrossFunction
    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 CrossFunction<IN1,​IN2,​OUT>
    extends Function, Serializable
    Interface for Cross functions. Cross functions are applied to the Cartesian product of their inputs and are called for each pair of elements.

    They are optional, a means of convenience that can be used to directly manipulate the pair of elements instead of producing 2-tuples containing the pairs.

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

    
     DataSet<X> set1 = ...;
     DataSet<Y> set2 = ...;
    
     set1.cross(set2).with(new MyCrossFunction());
     

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

    • Method Detail

      • cross

        OUT cross​(IN1 val1,
                  IN2 val2)
           throws Exception
        Cross UDF method. Called once per pair of elements in the Cartesian product of the inputs.
        Parameters:
        val1 - Element from first input.
        val2 - Element from the second input.
        Returns:
        The result element.
        Throws:
        Exception - The function may throw Exceptions, which will cause the program to cancel, and may trigger the recovery logic.