You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Robert Metzger (JIRA)" <ji...@apache.org> on 2019/02/13 09:41:00 UTC

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

    [ https://issues.apache.org/jira/browse/FLINK-11510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16766973#comment-16766973 ] 

Robert Metzger commented on FLINK-11510:
----------------------------------------

[~aljoscha] do you think this change is a good fit for Flink?

> 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
>            Assignee: wangpeibin
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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)