I am a new developper on Scala and I want to write a simple function :
def compute_start(start: Option[Long]) : (Int, Int, Int) = {
if (start != null.asInstanceOf[Long] && start != null && start != "null") { // I tried ALL THOSE OPTIONS !!!
var result = helper(start.get) // another function
(temp._1, temp._2, temp._3)
} else {
(0, 0, 0)
}
But I always get this error :
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 696.0 failed 8 times, most recent failure: Lost task 0.7 in stage 696.0 (TID 99422, ldatanode10ch.nms.ld, executor 145): java.util.NoSuchElementException: None.get
So, I guess that the condition if (start != null.asInstanceOf[Long] didn't return true.
Please, how can I avoid a null values for a long (or Option[long] ) variable ?? Thank you !