Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Do
-
None
-
None
Description
The goal is to implement a KeyedStream API to sum with multi field.
The example code with like:
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Tuple3<Long, Long, Integer>> src = env.fromCollection(Arrays.asList( new Tuple3<>(1L, 2L, 2), new Tuple3<>(1L, 3L, 3), new Tuple3<>(1L, 4L, 4), new Tuple3<>(2L, 2L, 2), new Tuple3<>(2L, 3L, 3), new Tuple3<>(2L, 4L, 4) )); src.keyBy(0) .sum(new int[] {1, 2}) // right now only sum(1) or sum("f0") is supported .print(); env.execute();
and the output is expected to be:
1> (1,2,2) 1> (2,2,2) 1> (1,5,5) 1> (2,5,5) 1> (1,9,9) 1> (2,9,9)