title: Count particular values in a Spark DF column combined with window functions
body: <p>Sample DF:</p>
  
  <pre><code>var some_df = Seq(
  ("A", "no"),
  ("B", "yes"),
  ("B", "yes"),
  ("B", "no")
  ).toDF(
  "user_id", "phone_number")
  </code></pre>
  
  <p>some_df.show()</p>
  
  <pre><code>+-------+------------+
  |user_id|phone_number|
  +-------+------------+
  |      A|          no|
  |      B|         yes|
  |      B|         yes|
  |      B|          no|
  +-------+------------+
  </code></pre>
  
  <p>I am trying to count the number of "yes" for each user_id.</p>
  
  <p>Code:</p>
  
  <pre><code>val omg_window = Window.partitionBy($"user_id")
  some_df = some_df.withColumn("my_col", 
  count($"phone_number"==="yes").over(omg_window)).drop("phone_number")
  some_df.show()
  </code></pre>
  
  <p>My OP:</p>
  
  <pre><code> +-------+------+
   |user_id|my_col|
   +-------+------+
   |      B|     3|
   |      B|     3|
   |      B|     3|
   |      A|     1|
   +-------+------+
  </code></pre>
  
  <p>Expected OP:</p>
  
  <pre><code>User Id .   my_col
   B .         2
   A .         0
  </code></pre>
  
  <p>Any suggestions on where I am going wrong will be highly helpful</p>