composite Main {
graph
@parallel(width=2)
stream<rstring word> Words = Custom() {
logic onProcess: {
while (true) {
// a "word" looks like "0", "1", ..., "99"
submit({word=(rstring)((int32)(random() * 100))}, Words);
}
}
}
@parallel(width=3, partitionBy=[{port=Words, attributes=[word]}])
stream<rstring word, int32 rolling_count> Counts = Aggregate(Words) {
window Words: sliding, time(9), time(3), partitioned;
param partitionBy: word;
output Counts: word=Any(), rolling_count=Count();
}
stream<rstring word, int32 rolling_count> Sorted = Sort(Words) {
window Words: sliding, time(2), time(2);
param sortBy: rolling_count;
}
stream<list<rstring word, int32 rolling_count> hist> Rankings = Aggregate(Sorted) {
window Sorted: tumbling, punctuation;
output Rankings: hist=Collect();
}
}
I did not parallelize the reduce part. I'd need to do some more thinking on how to do that, as I split it into two operators. I think it shows the flavor, though.Two caveats: One, I have not compiled and tested this, so errors may abound. I was just curious what the "flavor" of it would look like in our system. Two, standard disclaimer of I speak in an unofficial capacity, what I say does not represent IBM or Streams.
His post on writing Python streaming programs in Hadoop - http://www.michael-noll.com/tutorials/writing-an-hadoop-mapr... - got me started in this area two years ago, and that's what I'm still doing these days! :)
[1] http://spark.incubator.apache.org/
[2] http://www.cs.berkeley.edu/~matei/papers/2013/sosp_spark_str...
We're a well-funded company (raised an $11m Series B from a $15billion private equity firm) real-time big data analytics company for the enterprise. We're based in Palo Alto. If interested, feel free to shoot us a message!
jobs@webaction.com