[
https://issues.apache.org/jira/browse/FLINK-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14058685#comment-14058685
]
Stephan Ewen commented on FLINK-970:
------------------------------------
For this to work in all cases, we cannot rely on a single partition (or a
subset of partitions) to have the data. The only safe way is in my opinion to
reduce it to *n* in each partition, then have a single group reduce that
chooses the overall *n*. Otherwise we may get less if some partitions happen to
be empty by data skew.
> Implement a first(n) operator
> -----------------------------
>
> Key: FLINK-970
> URL: https://issues.apache.org/jira/browse/FLINK-970
> Project: Flink
> Issue Type: New Feature
> Reporter: Timo Walther
> Assignee: Chesnay Schepler
> Priority: Minor
>
> It is only syntactic sugar, but I had many cases where I just needed the
> first element or the first 2 elements in a GroupReduce.
> E.g. Instead of
> {code:java}
> .reduceGroup(new GroupReduceFunction<String, String>() {
> @Override
> public void reduce(Iterator<String>
> values, Collector<String> out) throws Exception {
> out.collect(values.next());
> }
> })
> {code}
> {code:java}
> .first()
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)