hive如何查詢函式並檢視函式使用方法

2021-09-05 10:44:19 字數 1376 閱讀 6659

我們在使用hive函式時經常會出現對函式名、引數使用及返回值等記憶模糊,然後需要到網上各種查詢資料。

今天來教大家一種使用hive命令模糊查詢相關函式名稱、函式的用法及詳細說明並舉例,較少大家查詢資料的時間,提高效率。

1.檢視date相關的函式

show functions like

'*date*';ok

current_date

date_add

date_format

date_sub

datediff

to_date

2.檢視datediff函式的用法

desc

function datediff;

okdatediff(date1, date2)

-returns the number of days between date1 and date2

time taken: 0.03 seconds, fetched: 1

row(s)

3.檢視datediff函式的詳細說明並舉例

desc

function

extended datediff;

okdatediff(date1, date2)

-returns the number of days between date1 and date2

date1 and date2 are strings in the format 'yyyy-mm-dd hh:mm:ss'

or'yyyy-mm-dd'

. the time parts are ignored.

if date1 is earlier than date2, the result is negative.

example:

>

select datediff(

'2009-07-30'

,'2009-07-31'

)from src limit1;

1function class:org.apache.hadoop.hive.ql.udf.generic.genericudfdatediff

function

type:builtin

time taken: 0.015 seconds, fetched: 7

row(s)

4.測試

select datediff(

'2018-12-25'

,'2018-12-26');

ok-1time taken: 0.128 seconds, fetched: 1

row(s)

hive 查詢函式並檢視函式使用方法

原創 2017年12月21日 18 08 23 1.檢視month 相關的函式 show functions like month 輸出如下 2.檢視 add months 函式的用法 desc function add months 3.檢視 add months 函式的詳細說明並舉例 desc ...

hive 日誌怎麼檢視 HIVE 如何檢視執行日誌

hive既然是執行在hadoop上,最後又被翻譯為mapreduce程式,通過yarn來執行。所以我們如果想解決hive 現的錯誤,需要分成幾個過程 hive自身翻譯成為mr之前的解析錯誤 hadoop檔案系統的錯誤 yarn排程過程中的錯誤 1.hive預設log檔案儲存的地方 tmp 資料夾的h...

hive詳解 函式檢視與使用 自定義函式

檢視有哪些函式 show functions 結果 檢視某函式的解釋 desc function upper 結果 檢視某函式的解釋以及示例 desc function extended upper 結果 1 hive 自帶了一些函式,比如 max min 等,但是數量有限,自己可以通過自定義 ud...