Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Do
-
None
-
None
Description
The goal is to implement a KeyedStream API to sum with the field which is array.
The example code with like:
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Tuple2<Long, Integer[]>> src = env.fromCollection(Arrays.asList( new Tuple2<>(1L, new Integer[]{2, 4}), new Tuple2<>(1L, new Integer[]{3, 6}), new Tuple2<>(1L, new Integer[]{4, 8}), new Tuple2<>(2L, new Integer[]{2, 4}), new Tuple2<>(2L, new Integer[]{3, 6}), new Tuple2<>(2L, new Integer[]{4, 8}) )); src.keyBy(0) .sum(1}) .print(); env.execute();
the expected output should be
(1,[2, 4]) (1,[5, 10]) (1,[9, 18]) (2,[2, 4]) (2,[5, 10]) (2,[9, 18])
right now this job will throw out exception:
java.lang.RuntimeException: DataStream cannot be summed because the class Integer[] does not support the + operator.
Attachments
Issue Links
- links to