Hi, Eugenio.

I haven't actually used it but you can give it a try. 


You can define a custom ProcessWindowFunction and using a map state in it. 
Every time the window is fired and the ProcessWindowFunction is called, do the 
avg and count about the elements in the window. 
And then decide to use the last avg in map state if there are no elements, or 
using the new avg and set the new avg in map state.


Hope it helps you!



--

    Best!
    Xuyang





在 2023-12-04 21:34:06,"Eugenio Marotti" <ing.eugenio.maro...@gmail.com> 写道:
>Hi everyone,
>
>I’m currently using Flink to calculate a moving average with a window size of 
>60 days and a slide of 30 days, and it works ok. The data I have are non 
>continuous every month (a month there is a data and for 3/4 months or even 
>more there are no data). Is there a way to output the moving average event 
>when the window has no data by outputting the previous average? In other terms 
>to maintain the average stable when the windows is empty?
>
>Thanks
>Eugenio

Reply via email to