How to compute the sum of orders over a 12 months period sliding by 1 month per customer in Spark
问题 I am relatively new to spark with Scala. currently I am trying to aggregate order data in spark over a 12 months period that slides monthly. Below is a simple sample of my data, I tried to format it so you can easily test it import spark.implicits._ import org.apache.spark.sql._ import org.apache.spark.sql.functions._ var sample = Seq(("C1","01/01/2016", 20), ("C1","02/01/2016", 5), ("C1","03/01/2016", 2), ("C1","04/01/2016", 3), ("C1","05/01/2017", 5), ("C1","08/01/2017", 5), ("C1","01/02