Набор данных Spark 2.0 против DataFrame

ение этой нулевой ошибки в spark Dataset.filter

Вход CSV:

name,age,stat
abc,22,m
xyz,,s

Рабочий код:

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 > 30").show()

Неверный код (Добавление следующих строк возвращает ошибку):

val filteredDS = peopleDS.filter(_.age > 30)
filteredDS.show()

Возвращает нулевую ошибку

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).

Ответы на вопрос(1)

Ваш ответ на вопрос