In Spark Streaming, using Scala or Java, how can I have a stream that always contains the most recent N
elements?
I'm familiar with the possibility to create windowed streams, using methods such as window(windowLength, slideInterval)
. Here, both windowLength
and slideInterval
are time intervals. Is there an equivalent where you specify a row (i.e. element) count for the length and interval of a stream?
If there is no provided API for such cases, how would you go about implementing it yourself?