且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将日期转换为时间戳,将unix_timestamp的Spark日期转换为时间戳的问题返回null

更新时间:2022-01-18 04:01:22

问题是智利的时间发生了变化,非常感谢.

The problem was the change of time in Chile, thank you very much.

+-------------------+---------+
|     DateIntermedia|TimeStamp|
+-------------------+---------+
|13-08-2017 00:01:07|     null|
|13-08-2017 00:10:33|     null|
|14-08-2016 00:28:42|     null|
|13-08-2017 00:04:43|     null|
|13-08-2017 00:33:51|     null|
|14-08-2016 00:28:08|     null|
|14-08-2016 00:15:34|     null|
|14-08-2016 00:21:04|     null|
|13-08-2017 00:34:13|     null|
+-------------------+---------+

解决方案,设置timeZone:

The solution, set timeZone:

  spark.conf.set("spark.sql.session.timeZone", "UTC-6")