wangpeibin created FLINK-11706:
----------------------------------
Summary: Add the SumFunction to support KeyedStream.sum with field which is array
Key: FLINK-11706
URL:
https://issues.apache.org/jira/browse/FLINK-11706 Project: Flink
Issue Type: Improvement
Components: DataStream API
Reporter: wangpeibin
Assignee: wangpeibin
The goal is to implement a KeyedStream API to sum with *the field which is array*.
The example code with like:
{code}
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();
{code}
right now this job will throw out exception:
{code:java}
java.lang.RuntimeException: DataStream cannot be summed because the class Integer[] does not support the + operator.
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)