title: Casting BigInt to Int in Spark
body: <p>Hi I'm trying to cast a <code>BigInt</code>to an <code>int</code>in order to generate <a href="https://spark.apache.org/docs/2.0.1/api/java/org/apache/spark/mllib/recommendation/Rating.html" rel="nofollow noreferrer">Rating</a> classes. 
  I only want to use instances that are small enough to fit into an in I use the following code:</p>
  
  <pre><code>val tup=rs.select("kunden_nr","product_list") 
  val rdd=tup.rdd.map(row=&gt;(row.getAs[BigInt](0),row.getAs[Seq[Int]](1)))
  val fs=rdd.filter(el=&gt;el._1.isValidInt)
  fs.count()
  rdd.count()
  </code></pre>
  
  <p>The fs count delivers the following exception in Zepplin:</p>
  
  <p><code>java.lang.ClassCastException: java.lang.Long cannot be cast to scala.math.BigInt</code></p>