title: How to find combination difference of a dataframe in Spark Scala?
body: <p>for example : </p>
  
  <pre><code>+------+
  |items |
  +------+
  |     1|
  |    14|
  |    11|
  |     3|
  |     0|
  |  0,13|
  |     8|
  |     7|
  |  7,11|
  |    13|
  +------+
  </code></pre>
  
  <p>I want to subtract each column value with other values of same column . for example subtract 1 with all other values then 14 with all other values like wise up to 13 . How is it possible ?</p>
  
  <p>I tried it with a udf function but its not working . </p>
  
  <pre><code> df.rdd.foreach(x =&gt; {
    val firstPoint= x.toSeq.toArray.map({
      case s: String =&gt; s.toInt
      case l: Long =&gt; l.toInt
      case d :Double =&gt; d.toInt
      case i : Int =&gt; i.toInt
      case f : Float =&gt; f.toInt
       })
       println(firstPoint.deep)
      items =  items.withColumn("col" + i, freq(firstPoint)(df.col("items")))
       i = i + 1
     })
  </code></pre>
  
  <p>It shows null pointer error . </p>