Hej, I have a windowed stream and I want to run a (generic) fold function on it. The result should have the start and the end time stamp of the window as fields (so I can relate it to the original data). *Is there a simple way to get the timestamps from within the fold function?*
I could find the lowest and the highest ts as part of the fold function but that would not be very accurate especially when I the number of events in the window is low. Also, I want to write in a generic way so I can use it even if the data itself does not contain a time stamp field (running on processing time). I have looked into using a WindowFunction where I would have access to the start and end timestamp. I have not quite figured out how I would implement a fold function using this. Also, from my understanding this approach would require holding the whole window in memory which is not a good option since the window data can get very large. Is there a better way of doing this cheers Martin