title: Spark 2 Dataset Null value exception
body: <p>Getting this null error in spark Dataset.filter</p>
  
  <p>Input CSV:</p>
  
  <pre><code>name,age,stat
  abc,22,m
  xyz,,s
  </code></pre>
  
  <p>Working code:</p>
  
  <pre><code>case class Person(name: String, age: Long, stat: String)
  
  val peopleDS = spark.read.option("inferSchema","true")
    .option("header", "true").option("delimiter", ",")
    .csv("./people.csv").as[Person]
  peopleDS.show()
  peopleDS.createOrReplaceTempView("people")
  spark.sql("select * from people where age &gt; 30").show()
  </code></pre>
  
  <p>Failing code (<em>Adding following lines return error</em>):</p>
  
  <pre><code>val filteredDS = peopleDS.filter(_.age &gt; 30)
  filteredDS.show()
  </code></pre>
  
  <p>Returns null error</p>
  
  <pre><code>java.lang.RuntimeException: Null value appeared in non-nullable field:
  - field (class: "scala.Long", name: "age")
  - root class: "com.gcp.model.Person"
  If the schema is inferred from a Scala tuple/case class, or a Java bean, please try to use scala.Option[_] or other nullable types (e.g. java.lang.Integer instead of int/scala.Int).
  </code></pre>