Interface MapFunction<T,​O>

  • Type Parameters:
    T - Type of the input elements.
    O - Type of the returned elements.
    All Superinterfaces:
    Function, Serializable
    All Known Implementing Classes:
    RichMapFunction
    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 MapFunction<T,​O>
    extends Function, Serializable
    Base interface for Map functions. Map functions take elements and transform them, element wise. A Map function always produces a single result element for each input element. Typical applications are parsing elements, converting data types, or projecting out fields. Operations that produce multiple result elements from a single input element can be implemented using the FlatMapFunction.

    The basic syntax for using a MapFunction is as follows:

    
     DataSet<X> input = ...;
    
     DataSet<Y> result = input.map(new MyMapFunction());
     
    • Method Detail

      • map

        O map​(T value)
        throws Exception
        The mapping method. Takes an element from the input data set and transforms it into exactly one element.
        Parameters:
        value - The input value.
        Returns:
        The transformed value
        Throws:
        Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.