title: Spark SQL sum rows with the same key and appending the sum value
body: <p>Suppose I have the following DataFrame.</p>
  
  <pre><code>+----+-----+
  |lang|count|
  +----+-----+
  |  en|    4|
  |  en|    5|
  |  de|    2|
  |  en|    2|
  |  nl|    4|
  |  nl|    5|
  +----+-----+
  </code></pre>
  
  <p>How do I sum the values of “count” for each unique language, and appending this value as a new column (thus, without reducing the amount of rows)?</p>
  
  <p>In my example, this would result in:</p>
  
  <pre><code>+----+-----+----------------+
  |lang|count|totalCountInLang|
  +----+-----+----------------+
  |  en|    4|              11|
  |  en|    5|              11|
  |  de|    2|               2|
  |  en|    2|              11|
  |  nl|    4|               9|
  |  nl|    5|               9|
  +----+-----+----------------+
  </code></pre>
  
  <p>The DataFrames are constructed through a <code>map</code> operation on a <code>DStream</code>.</p>
  
  <p>Any suggestions on what would be the best way to achieve this? Is there a more efficient way than using DataFrames?</p>
  
  <p>Thanks in advance!</p>