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

Fabian Hueske commented on FLINK-1398:
--------------------------------------

I am not sure how useful / how much needed such an operator is. 
Designing an API includes finding the right trade-off of conciseness and 
providing build-in operators.

Extracting an element can be done using a trivial MapFunction, in Scala or 
Java8 even a lambda function. So this is just syntactic sugar for convenience. 
For that we would pay with two additional methods (one with an Integer index 
for tuples and another one with a field expression String for Pojo and tuple 
types) in the API which is already quite loaded, IMO.

My feeling is, that the gain is not enough for extending the API, but I am open 
for other arguments ;-)

> A new DataSet function: extractElementFromTuple
> -----------------------------------------------
>
>                 Key: FLINK-1398
>                 URL: https://issues.apache.org/jira/browse/FLINK-1398
>             Project: Flink
>          Issue Type: Wish
>            Reporter: Felix Neutatz
>            Priority: Minor
>
> This is the use case:
> {code:xml}
>         DataSet<Tuple2<Integer, Double>> data =  env.fromElements(new 
> Tuple2<Integer, Double>(1,2.0));
>         
>         data.map(new ElementFromTuple());
>         
>     }
>     public static final class ElementFromTuple implements 
> MapFunction<Tuple2<Integer, Double>, Double> {
>         @Override
>         public Double map(Tuple2<Integer, Double> value) {
>             return value.f1;
>         }
>     }
> {code}
> It would be awesome if we had something like this:
> {code:xml}
>     data.extractElement(1);
> {code}
> This means that we implement a function for DataSet which extracts a certain 
> element from a given Tuple.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to