Can unix_timestamp() return unix time in milliseconds in Apache Spark?

前端 未结 4 1705
情深已故
情深已故 2021-02-12 20:17

I\'m trying to get the unix time from a timestamp field in milliseconds (13 digits) but currently it returns in seconds (10 digits).

scala> var df = Seq(\"20         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-02-12 21:20

    unix_timestamp() return unix timestamp in seconds.

    The last 3 digits in the timestamps are the same with the last 3 digits of the milliseconds string (1.999sec = 1999 milliseconds), so just take the last 3 digits of the timestamps string and append to the end of the milliseconds string.

提交回复
热议问题