klion26 commented on issue #7786: [FLINK-11706] Add the SumFunction to support 
KeyedStream.sum
URL: https://github.com/apache/flink/pull/7786#issuecomment-465961173
 
 
   How about the below code
   ```
   src.flatMap(new FlatMapFunction<Tuple2<Long, Integer[]>, Tuple2<Long, 
Integer>>() {
        @Override
        public void flatMap(Tuple2<Long, Integer[]> value, 
Collector<Tuple2<Long, Integer>> out) throws Exception {
            for (Integer v : value.f1) {
                out.collect(new Tuple2<>(value.f0, v));
               }
        }
       }).keyBy(0)
       .sum(1)
       .print();
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to