Re: How to convert List to flink DataSet

2016-02-12 Thread subash basnet
Hello Fabian, Thank you for the response, but I have been stuck on how to iterate over the DataSet, perform operations and return a new modified DataSet similar to that of list operation as shown below. Eg: Currently I am doing the following: for (Centroid centroid : centroids.collect()) { for

Re: How to convert List to flink DataSet

2016-02-10 Thread Fabian Hueske
I would try to do the outlier compuation with the DataSet API instead of fetching the results to the client with collect(). If you do that, you can directly use writeAsCsv because the result is still a DataSet. What you have to do, is to translate your findOutliers method into DataSet API code. B

Re: How to convert List to flink DataSet

2016-02-10 Thread subash basnet
Hello Fabian, As written before code: *DataSet fElements = env.fromCollection(findOutliers(clusteredPoints, finalCentroids));fElements.writeAsCsv(outputPath, "\n", " ");env.execute("KMeans Example");* I am very new to flink so not so clear about what you suggested, by option(1) you meant that I

Re: How to convert List to flink DataSet

2016-02-10 Thread Fabian Hueske
Hi Subash, I would not fetch the data to the client, do the computation there, and send it back, just for the purpose of writing it to a file. Either 1) pull the results to the client and write the file from there or 2) compute the outliers in the cluster. I did not study your code completely, bu

Re: How to convert List to flink DataSet

2016-02-10 Thread Fabian Hueske
Hi Subash, how is findOutliers implemented? It might be that you mix-up local and cluster computation. All DataSets are processed in the cluster. Please note the following: - ExecutionEnvironment.fromCollection() transforms a client local connection into a DataSet by serializing it and sending it

Re: How to convert List to flink DataSet

2016-02-10 Thread subash basnet
Hello Stefano, Yeah the type casting worked, thank you. But not able to print the Dataset to the file. The default below code which writes the KMeans points along with their centroid numbers to the file works fine: // feed new centroids back into next iteration DataSet finalCentro

Re: How to convert List to flink DataSet

2016-02-09 Thread Stefano Baghino
Assuming your EnvironmentContext is named `env` Simply call: DataSet> fElements = env.*fromCollection* (finalElements); Does this help? On Tue, Feb 9, 2016 at 6:06 PM, subash basnet wrote: > Hello all, > > I have performed a modification in KMeans code to detect outliers. I have > printed the

How to convert List to flink DataSet

2016-02-09 Thread subash basnet
Hello all, I have performed a modification in KMeans code to detect outliers. I have printed the output in the console but I am not able to write it to the file using the given 'writeAsCsv' method. The problem is I generate a list of tuples. My List is: List finalElements = new ArrayList(); Follow