flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srikanth <srikanth...@gmail.com>
Subject Re: how to convert datastream to collection
Date Tue, 03 May 2016 16:04:17 GMT
Why do you want collect and iterate? Why not iterate on the DataStream
itself?
May be I didn't understand your use case completely.

Srikanth

On Tue, May 3, 2016 at 10:55 AM, Aljoscha Krettek <aljoscha@apache.org>
wrote:

> Hi,
> please keep in mind that we're dealing with streams. The Iterator might
> never finish.
>
> Cheers,
> Aljoscha
>
> On Tue, 3 May 2016 at 16:35 Suneel Marthi <smarthi@apache.org> wrote:
>
>> DataStream<Tuple2<String,Point>> *newCentroids = new DataStream<>.....()*
>>
>> *Iterator<Tuple2<String, Point>> iter =
>> DataStreamUtils.collect(newCentroids);*
>>
>> *List<Tuple2<>> list = Lists.newArrayList(iter);*
>>
>> On Tue, May 3, 2016 at 10:26 AM, subash basnet <yasubash@gmail.com>
>> wrote:
>>
>>> Hello all,
>>>
>>> Suppose I have the datastream as:
>>> DataStream<Tuple2<String,Point>> *newCentroids*;
>>>
>>> How to get collection of *newCentroids * to be able to loop as below:
>>>  private Collection<Tuple2<String,Point>> *centroids*;
>>>  for (Centroid cent : *centroids*) {
>>>   }
>>>
>>>
>>>
>>> Best Regards,
>>> Subash Basnet
>>>
>>
>>

Mime
View raw message