How to select current date in Hive SQL

后端 未结 6 840
谎友^
谎友^ 2020-12-24 00:11

How do we get the current system date in Hive? In MySQL we have select now(), can any one please help me to get the query results. I am very new to Hive, is there a proper d

6条回答
  •  被撕碎了的回忆
    2020-12-24 00:42

    Yes... I am using Hue 3.7.0 - The Hadoop UI and to get current date/time information we can use below commands in Hive:

    SELECT from_unixtime(unix_timestamp()); --/Selecting Current Time stamp/
    
    SELECT CURRENT_DATE; --/Selecting Current Date/
    
    SELECT CURRENT_TIMESTAMP; --/Selecting Current Time stamp/
    

    However, in Impala you will find that only below command is working to get date/time details:

    SELECT from_unixtime(unix_timestamp()); --/Selecting Current Timestamp /
    

    Hope it resolves your query :)

提交回复
热议问题