How to sum the values of one column of a dataframe in spark/scala
<p>I have a Dataframe that I read from a CSV file with many columns like: timestamp, steps, heartrate etc.</p>

<p>I want to sum the values of each column, for instance the total number of steps on "steps" column.</p>

<p>As far as I see I want to use these kind of functions: 
<a href="http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions$" rel="noreferrer">http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions$</a></p>

<p>But I can understand how to use the function sum. </p>

<p>When I write the following:</p>

<pre><code>val df = CSV.load(args(0))
val sumSteps = df.sum("steps") 
</code></pre>

<p>the function sum cannot be resolved. </p>

<p>Do I use the function sum wrongly? 
Do Ι need to use first the function map? and if yes how?</p>

<p>A simple example would be very helpful! I started writing Scala recently. </p>