flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Rohrmann (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-1098) flatArray() operator that converts arrays to elements
Date Wed, 17 Sep 2014 08:00:41 GMT

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

Till Rohrmann commented on FLINK-1098:

I'd also rather prefer option (2) to option (1). Besides the maintenance costs, I believe
that the user would not always be aware of all the special case functions. Thus, he will often
end up implementing the special case functions himself with the well-known elementary functions.

For the concrete use case, I think that the flatMap solution is perfectly fine. What we could
think about is to extend the flatMap operator such that it would also treat arrays as collections.
This might, however, not be very crucial.

> flatArray() operator that converts arrays to elements
> -----------------------------------------------------
>                 Key: FLINK-1098
>                 URL: https://issues.apache.org/jira/browse/FLINK-1098
>             Project: Flink
>          Issue Type: New Feature
>            Reporter: Timo Walther
>            Priority: Minor
> It would be great to have an operator that converts e.g. from String[] to String. Actually,
it is just a flatMap over the elements of an array.
> A typical use case is a WordCount where we then could write:
> {code}
> text
> .map((line) -> line.toLowerCase().split("\\W+"))
> .flatArray()
> .map((word) -> new Tuple2(word, 1))
> .groupBy(0)
> .sum(1);
> {code}

This message was sent by Atlassian JIRA

View raw message