java.lang.NullPointerException: Null value appeared in non-nullable field:
top level Product input object
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).
package com.testimport org.apache.spark.sql.{Dataset, SparkSession}import java.langimport scala.collection.mutable.ListBufferimport scala.util.control.Breaks.{break, breakable}object scalaDemo1 { def main(args: Array[String]): Unit = { val spark = SparkSession.builder() .master("local[*]") .appName("yy") .getOrCreate() val sc = spark.sparkContext spark.sparkContext.setLogLevel("ERROR") // For implicit conversions like converting RDDs to Dataframes import spark.implicits._ import org.apache.spark.sql.functions._ //解决:无法重载方法agg // 方法1 val