My timestamp in real data would be like this or as shown below
2018-02-28T00:05:20.3717898Z
2018-02-28T00:05:23.6589778Z
2018-02-28T00:05:23.9119922Z
2018-02-28T00:05:25.4230787Z
2018-02-28T00:05:25.6710929Z
2018-02-28T00:05:26.4271361Z
And I use this code to read the data
userSchema=StructType().add('time','timestamp')
s=spark.readStream.schema(userSchema).csv('xxxx')
The result is like this
Complete no idea how it happened.