¿Producto acumulativo en Spark?

Intento implementar un producto acumulativo en Spark scala pero realmente no sé cómo hacerlo. Tengo el siguiente marco de datos:

Input data:
+--+--+--------+----+
|A |B | date   | val|
+--+--+--------+----+
|rr|gg|20171103| 2  |
|hh|jj|20171103| 3  |
|rr|gg|20171104| 4  |
|hh|jj|20171104| 5  |
|rr|gg|20171105| 6  |
|hh|jj|20171105| 7  |
+-------+------+----+

Y me gustaría tener el siguiente resultado

Output data:
+--+--+--------+-----+
|A |B | date   | val |
+--+--+--------+-----+
|rr|gg|20171105| 48  | // 2 * 4 * 6
|hh|jj|20171105| 105 | // 3 * 5 * 7
+-------+------+-----+

Si tiene alguna idea sobre cómo hacerlo, sería realmente útil:)

Muchas gracia

Respuestas a la pregunta(2)

Su respuesta a la pregunta