how to calculate a column in a row using two columns of the previous row in spark data frame?,df.show()