Why do I see 200 tasks in Spark execution?
September 24, 2021What are applications, jobs, stages and tasks in Spark?
September 29, 2021Pretty simple problem with a simple solution.
Solution
CURRENT_DATE will give the current date and CURRENT_TIMESTAMP will give you the date and time.
0: jdbc:hive2://ms2.hirw.com:2181,wk1.hirw.co> SELECT CURRENT_DATE; +-------------+--+ | _c0 | +-------------+--+ | 2020-11-12 | +-------------+--+ 0: jdbc:hive2://ms2.hirw.com:2181,wk1.hirw.co> SELECT CURRENT_TIMESTAMP; +--------------------------+--+ | _c0 | +--------------------------+--+ | 2020-11-12 18:00:47.827 | +--------------------------+--+
If you want to work with EPOCH time then use unix_timestamp() to get the EPOCH time and use from_unixtime to convert EPOCH to date and time.
0: jdbc:hive2://ms2.hirw.com:2181,wk1.hirw.co> SELECT unix_timestamp(); +-------------+--+ | _c0 | +-------------+--+ | 1605204223 | +-------------+--+ 1 row selected (0.133 seconds) 0: jdbc:hive2://ms2.hirw.com:2181,wk1.hirw.co> SELECT from_unixtime(unix_timestamp()); +----------------------+--+ | _c0 | +----------------------+--+ | 2020-11-12 18:04:39 | +----------------------+--+ 1 row selected (0.565 seconds)
1 Comment
[…] + View More Here […]