[jira] [Created] (FLINK-11510) Add the MultiFieldSumAggregator to support KeyedStream.sum(int[] positionToSums )

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-11510) Add the MultiFieldSumAggregator to support KeyedStream.sum(int[] positionToSums )

Shang Yuanchun (Jira)
wangpeibin created FLINK-11510:
----------------------------------

             Summary: Add the MultiFieldSumAggregator to support KeyedStream.sum(int[] positionToSums )
                 Key: FLINK-11510
                 URL: https://issues.apache.org/jira/browse/FLINK-11510
             Project: Flink
          Issue Type: Improvement
            Reporter: wangpeibin


The goal is to implement a KeyedStream API to sum with *multi field*.

The example code with like:
{code:java}
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();

 
{code}
and the output is expected to be:
{code:java}
1> (1,2,2)
1> (2,2,2)
1> (1,5,5)
1> (2,5,5)
1> (1,9,9)
1> (2,9,9)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)