Re: DataStreamUtils not working properly

2016-07-20 Thread subash basnet
Hello maximilian, Then as you said, in starting question of thread: Iterator iter = DataStreamUtils.collect(centroids); Collection testCentroids = Lists.newArrayList(iter); for(Centroid c: testCentroids){ System.out.println(c); } The above waits until the iterator doesn't have data anymore, and

Re: DataStreamUtils not working properly

2016-07-20 Thread Maximilian Michels
Everything works as expected. The while loop blocks until the iterator doesn't have data anymore (=the program has ended). All data will end up in the ArrayList. The latter exception comes from a duplicate call to execute(). Actually, collect() internally calls execute() because the job has to run

Re: DataStreamUtils not working properly

2016-07-20 Thread subash basnet
hello maximilian, Thanks! I learned new thing today :). But my problem still exists. Your example has little data and it works fine. But in my datastream I have set timeWindow as Time.seconds(5). What I found out is, if I print as below as your example: Iterator iter = DataStreamUtils.collect(cen

Re: DataStreamUtils not working properly

2016-07-20 Thread Maximilian Michels
Ah, now I see where the problem lies. You're reusing the Iterator which you have already used in the for loop. You can only iterate over the elements once! This is the nature of the Java Iterator and DataStreamUtils.collect(..) returns an iterator. On Wed, Jul 20, 2016 at 1:11 PM, subash basnet w

Re: DataStreamUtils not working properly

2016-07-20 Thread subash basnet
Hello Maximilian, Thank's for the update. Yup it works in the example you gave. I checked with collection also it works. But not in my datastream case after the collection. DataStream centroids = *newCentroidDataStream*.map(new TupleCentroidConverter()); Iterator iter = DataStreamUtils.collect(cen

Re: DataStreamUtils not working properly

2016-07-20 Thread Maximilian Michels
Just tried the following and it worked: public static void main(String[] args) throws IOException { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); final DataStreamSource source = env.fromElements(1, 2, 3, 4); source.print(); final Iterator iter

Re: DataStreamUtils not working properly

2016-07-19 Thread subash basnet
Hello Till, Yup I can see the log output in my console, but there is no information there regarding if there is any error in conversion. Just normal warn and info as below: 22:09:16,676 WARN org.apache.flink.streaming.runtime.tasks.StreamTask - No state backend has been specified, using def

Re: DataStreamUtils not working properly

2016-07-19 Thread Till Rohrmann
It depends if you have a log4j.properties file specified in your classpath. If you see log output on the console, then it should also print errors there. Cheers, Till On Tue, Jul 19, 2016 at 3:08 PM, subash basnet wrote: > Hello Till, > > Shouldn't it write something in the eclipse console if t

Re: DataStreamUtils not working properly

2016-07-19 Thread subash basnet
Hello Till, Shouldn't it write something in the eclipse console if there is any error or warning. But nothing about error is printed on the console. And I checked the flink project folder: flink-core, flink streaming as such but couldn't find where the log is written when run via eclipse. Best Re

Re: DataStreamUtils not working properly

2016-07-19 Thread Till Rohrmann
Have you checked your logs whether they contain some problems? In general it is not recommended collecting the streaming result back to your client. It might also be a problem with `DataStreamUtils.collect`. Cheers, Till On Tue, Jul 19, 2016 at 2:42 PM, subash basnet wrote: > Hello all, > > I t

Re: DataStreamUtils not working properly

2016-07-19 Thread subash basnet
Hello all, I tried to check if it works for tuple but same problem, the collection still shows blank result. I took the id of centroid tuple and printed it, but the collection displays empty. DataStream centroids = newCentroidDataStream.map(new TupleCentroidConverter()); DataStream> centroidId =

DataStreamUtils not working properly

2016-07-19 Thread subash basnet
Hello all, I am trying to convert datastream to collection, but it's shows blank result. There is a stream of data which can be viewed on the console on print(), but the collection of the same stream shows empty after conversion. Below is the code: DataStream centroids = newCentroidDataStream.map