Re: How to perform Broadcast and groupBy in DataStream like DataSet
Posted by
subashbasnet on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/How-to-perform-Broadcast-and-groupBy-in-DataStream-like-DataSet-tp6644p6657.html
Hello Stefano,
Thank you, I found out that just sometime ago that I could use keyBy, but I couldn't find how to set and getBroadcastVariable in datastream like that of dataset.
For example in below code we get collection of
centroids via broadcast.
Eg: In KMeans.java
class X extends MapFunctions<>{
private Collection<Centroid>
centroids;
public void open(Configuration parameters) throws Exception {
this.centroids = getRuntimeContext().getBroadcastVariable("centroids");
}
for (Centroid cent :
centroids) {
}
}
Best Regards,
Subash Basnet