Exception in thread “main“ org.apache.spark.SparkUpgradeException: You may get a different result du

这篇博客主要讨论了在使用Spark3.0时遇到的时间解析问题,由于API升级导致无法识别'YYYY-MM-dd'格式。解决方案是通过设置`spark.sql.legacy.timeParserPolicy`为`LEGACY`来恢复旧版行为,例如:`val spark = SparkSession.builder().appName(top-three).master(local[2]).config(spark.sql.legacy.timeParserPolicyLEGACY).getOrCreate()`。这可以帮助开发者解决因版本升级引起的时间处理兼容性问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值