Parallel reduceByKeyAndWindow()s with different time values

360 views Asked by At

I am working on Spark Streaming on a use case which demands 4 different outputs computed on different window lengths.

In particular, I need my program to output the result of the computation every second based on 4 different time windows (windows are independent each other).

So far I implemented it on a single window of 60 seconds by calling

.reduceByKeyAndWindow(comingTs, leavingTs, Durations.seconds(60), Durations.seconds(1))
.cache();

on a JavaPairDStream<K, V> object (batches are supposed to be 1 second long). After that, computations on those tuples happen.

Now, during that very same second I'd need to output results for windows that are 300 and 600 seconds long, independently each other.

My question is: is that even approachable in Spark Streaming? I am relatively new to it, and I could not say. If yes, can someone suggest me how to do that?

0

There are 0 answers