Hi, Did you consider timezone in conversion in your UDF?
On Tue, Jan 22, 2019 at 5:29 AM 徐涛 <happydexu...@gmail.com> wrote: > Hi Experts, > I have the following two UDFs, > unix_timestamp: transform from string to Timestamp, with the > arguments (value:String, format:String), return Timestamp > from_unixtime: transform from Timestamp to String, with the > arguments (ts:Long, format:String), return String > > > select > number, > ts, > from_unixtime(unix_timestamp(LAST_UPDATE_TIME, 'EEE MMM dd > HH:mm:Ss z yyyy'),'yyyy-MM-dd') as dt > from > test; > > when the LAST_UPDATE_TIME value is "Tue Jan 22 21:03:12 CST 2019”, > the unix_timestamp return a Timestamp with value 1548162182001. > but when from_unixtime is invoked, the timestamp with > value 1548190982001 is passed in, there are 8 hours shift between them. > May I know why there are 8 hours shift between them, and how can I > get the timestamp that are passed out originally from the first UDF without > changing the code? > Thanks very much. > > Best > Henry >