Details
-
Documentation
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.4.5
-
None
Description
`CAST(n,TIMESTAMPTYPE)` If n is Byte/Short/Int/Long data type, Hive treat n as milliseconds unit , while Spark SQL as seconds unit. so the cast result is different,please be care when you use it.
For example:
In spark spark-sql> select cast(1586318188000 as timestamp); 52238-06-04 13:06:400.0 spark-sql> select cast(1586318188 as timestamp); 2020-04-08 11:56:28 In Hive hive> select cast(1586318188000 as timestamp); 2020-04-08 11:56:28 hive> select cast(1586318188 as timestamp); 1970-01-19 16:38:38.188