title: Group and count spark dataframe for approxSimilarityJoin
body: <p>If we have a dataframe output of model.approxSimilarityJoin of</p>
  
  <pre><code>val results =
    model
     .approxSimilarityJoin(vectorizedDf, vectorizedDf, threshold)
     .filter("distCol != 0")
     .filter("distCol &lt; 0.2")
     .select(col("datasetA.title").alias("idA"), col("datasetB.title").alias("idB"), col("distCol"))
  </code></pre>
  
  <p>output of the above command</p>
  
  <pre><code>**idA|idB|distCol**  
  A|B|0.125 
  B|C|0.125 
  A|D|0.125 
  D|E|0.125  
  F|G|0.125 
  X|Y|0.19 
  A|M|0.14 
  A|N|0.14
  </code></pre>
  
  <p>we want the output to be grouped and count similar item i.e in the example above
  we have</p>
  
  <pre><code>A, B, C, D, E  
  F,G
  X,Y
  </code></pre>
  
  <p>the final output required  should be  like:</p>
  
  <pre><code>A, 0.125, 5
  F, 0.19, 1
  A, 0.14, 2
  </code></pre>