You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by subash basnet <ya...@gmail.com> on 2016/03/06 19:10:36 UTC

Retrieve elements from the Dataset without using collect

Hello all,

My requirement is to get suppose top '10' elements from the DataSet as
another DataSet. How would I do that without using collect.
Eg:
*DataSet<Tuple2<Integer, Double[]>> counts =* *data.flatMap(new
Tokenizer());*

I want a new DataSet containing 10 elements of *counts*.

And, what would be the way to retrieve individual elements of DataSet
without using list via collect?


Best Regards,
Subash Basnet

Re: Retrieve elements from the Dataset without using collect

Posted by Konstantin Knauf <ko...@tngtech.com>.
Hi Subash,

I think Dataset.first(int n) is what you are looking for.

Cheers,

Konstantin

On 06.03.2016 19:10, subash basnet wrote:
> Hello all, 
> 
> My requirement is to get suppose top '10' elements from the DataSet as
> another DataSet. How would I do that without using collect. 
> Eg:
> *DataSet<Tuple2<Integer, Double[]>> counts =* *data.flatMap(new
> Tokenizer());*
> 
> I want a new DataSet containing 10 elements of *counts*. 
> 
> And, what would be the way to retrieve individual elements of DataSet
> without using list via collect?
> 
> 
> Best Regards,
> Subash Basnet

-- 
Konstantin Knauf * konstantin.knauf@tngtech.com * +49-174-3413182
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Christoph Stock, Dr. Robert Dahlke
Sitz: Unterföhring * Amtsgericht München * HRB 135082

Re: Retrieve elements from the Dataset without using collect

Posted by subash basnet <ya...@gmail.com>.
Hello Konstantin,

Yup thanks.


Best Regards,
Subash Basnet

On Sun, Mar 6, 2016 at 7:20 PM, Konstantin Knauf <
konstantin.knauf@tngtech.com> wrote:

> [image: Boxbe] <https://www.boxbe.com/overview> This message is eligible
> for Automatic Cleanup! (konstantin.knauf@tngtech.com) Add cleanup rule
> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Ftoken%3Dl6m1%252BAW3wp%252BSoSN4fX7dAJPb7yli5bhonVZss1UaNrdPGq900IERcf6Dk%252FdMehYgYvJtcXnJ2m0buYMHQN%252Fkr5X177qBM%252BWr0L9b58yiFFCeBcf6J5hHUD7GuWxP7ZqopZIZKe%252BQpCSCXj4B6iLl8w%253D%253D%26key%3DZzX4vyRPUUacLOWlAWFZO3sxl1o%252Fuxm3z9IZpDP52qA%253D&tc_serial=24623056386&tc_rand=1827677866&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001>
> | More info
> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=24623056386&tc_rand=1827677866&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001>
>
> Hi Subash,
>
> I think Dataset.first(int n) is what you are looking for.
>
> Cheers,
>
> Konstantin
>
> On 06.03.2016 19:10, subash basnet wrote:
> > Hello all,
> >
> > My requirement is to get suppose top '10' elements from the DataSet as
> > another DataSet. How would I do that without using collect.
> > Eg:
> > *DataSet<Tuple2<Integer, Double[]>> counts =* *data.flatMap(new
> > Tokenizer());*
> >
> > I want a new DataSet containing 10 elements of *counts*.
> >
> > And, what would be the way to retrieve individual elements of DataSet
> > without using list via collect?
> >
> >
> > Best Regards,
> > Subash Basnet
>
> --
> Konstantin Knauf * konstantin.knauf@tngtech.com * +49-174-3413182
> TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
> Geschäftsführer: Henrik Klagges, Christoph Stock, Dr. Robert Dahlke
> Sitz: Unterföhring * Amtsgericht München * HRB 135082
>
>