Q:

Spark sum by key without reducing rows

I have an RDD with the following structure:
(lang, id, name, max, min)

I want to add another column, total, which holds the subtraction of the maximum value of column max and the minimum of column min for every unique lang (without reducing the amount of rows). So I would get something like 
rdd:
+----+--+----+---+---+
|lang|id|name|max|min|
+----+--+----+---+---+
|  en|  |    |  5|  1|
|  en|  |    |  2|  0|
|  de|  |    |  9|  2|
|  en|  |    |  7|  1|
|  nl|  |    |  3|  0|
|  nl|  |    |  5| 1|
+----+--+----+---+---+

To
rdd:
+----+--+----+---+---+-----+
|lang|id|name|max|min|total|
+----+--+----+---+---+-----+
|  en|  |    |  5|  1|    7|
|  en|  |    |  2|  0|    7|
|  de|  |    |  9|  2|    7|
|  en|  |    |  7|  1|    7|
|  nl|  |    |  3|  0|    5|
|  nl|  |    |  5|  1|    5|
+----+--+----+---+---+-----+

For compatibility reasons, I want to achieve this without using DataFrames/Spark SQL.
Any suggestion is much appreciated!

A:

You can aggregate:
val rdd = sc.parallelize(Seq(
  ("en", "id1", "name1", 5,  1), ("en", "id2", "name2",