I am learning about spark streaming, and i came across the function reduceByKeyAndWindow. It seems to be passed two lambda functions in official documention
reduceByKeyAndWindow(lambda x, y: x + y, lambda x, y: x - y, 30, 10)
I am a bit confuse, as to why second function is passed. As far as i know one function to reduce value is enough. I wanted to know what is the significance of the second function.