Exception in thread "main" org.apache.spark.SparkUpgradeException: You may get a different result due to the upgrading of Spark 3.0: Fail to recognize 'YYYY-MM-dd' pattern in the DateTimeFormatter. 1) You can set spark.sql.legacy.timeParserPolicy to LEGACY to restore the behavior before Spark 3.0. 2)
我的问题可能是使用关于时间的API时,没有设置某些参数
将SparkSession 定义成下面的样子即可
val spark = SparkSession .builder() .appName("top-three") .master("local[2]") .config("spark.sql.legacy.timeParserPolicy", "LEGACY") .getOrCreate()