Hive TimeStamp
是hive中的一种数据类型 对应的时间格式为yyyy-MM-dd HH:MM:SS
Hive中使用current_timestamp()函数获取当前时间,精确到毫秒
select current_timestamp();
+--------------------------+--+
| _c0 |
+--------------------------+--+
| 2019-06-02 15:31:33.355 |
+--------------------------+--+
1 row selected (0.316 seconds)
Hive中获取当前时间戳,默认使用unix_timestamp()函数,精确到秒
select unix_timestamp();
+-------------+--+
| _c0 |
+-------------+--+
| 1559460765 |
+-------------+--+
1 row selected (0.194 seconds)
Hive中获取时间戳的方式为unix_timestamp()函数,该函数只能够精确到秒级别的时间,对于时间精确到要求高的应用则该函数并不适合。
Hive获取当前时间毫秒级别的时间戳时需要使用cast函数将current_timestamp()转为double类型并乘以1000,则得到毫秒级别的时间戳。
对于Hive库中存储的