Sql Window functions in scala (WITH NO SPARK)

Hi,

I have raised a question in the stack overflow I am doing this exercise for my own knowledge, I am stuck with sliding windows implementation in scala can anyone help me out ?

Thanks
Sri