Class FirstReducer<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.functions.GroupCombineFunction<T,​T>, org.apache.flink.api.common.functions.GroupReduceFunction<T,​T>

    @Internal
    public class FirstReducer<T>
    extends Object
    implements org.apache.flink.api.common.functions.GroupReduceFunction<T,​T>, org.apache.flink.api.common.functions.GroupCombineFunction<T,​T>
    Reducer that only emits the first N elements in a group.
    See Also:
    Serialized Form
    • Constructor Detail

      • FirstReducer

        public FirstReducer​(int n)
    • Method Detail

      • reduce

        public void reduce​(Iterable<T> values,
                           org.apache.flink.util.Collector<T> out)
                    throws Exception
        Specified by:
        reduce in interface org.apache.flink.api.common.functions.GroupReduceFunction<T,​T>
        Throws:
        Exception
      • combine

        public void combine​(Iterable<T> values,
                            org.apache.flink.util.Collector<T> out)
                     throws Exception
        Specified by:
        combine in interface org.apache.flink.api.common.functions.GroupCombineFunction<T,​T>
        Throws:
        Exception