HIVE全部函数详解

Posted 早起的码农

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HIVE全部函数详解相关的知识,希望对你有一定的参考价值。

函数名 含义及实例
abs abs(x) - returns the absolute value of x
Example:
  > SELECT abs(0) FROM src LIMIT 1;
  0
  > SELECT abs(-5) FROM src LIMIT 1;
  5
acos acos(x) - returns the arc cosine of x if -1<=x<=1 or NULL otherwise
Example:
  > SELECT acos(1) FROM src LIMIT 1;
  0
  > SELECT acos(2) FROM src LIMIT 1;
add_months add_months(start_date, num_months) - Returns the date that is num_months after start_date.
start_date is a string in the format 'yyyy-MM-dd HH:mm:ss' or 'yyyy-MM-dd'. num_months is a number. The time part of start_date is ignored.
Example:
  > SELECT add_months('2009-08-31', 1) FROM src LIMIT 1;
 '2009-09-30'
aes_decrypt aes_decrypt(input binary, key string/binary) - Decrypt input using AES.
AES (Advanced Encryption Standard) algorithm. Key lengths of 128, 192 or 256 bits can be used. 192 and 256 bits keys can be used if Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files are installed. If either argument is NULL or the key length is not one of the permitted values, the return value is NULL.
Example: > SELECT aes_decrypt(unbase64('y6Ss+zCYObpCbgfWfyNWTw=='), '1234567890123456');
 'ABC'
aes_encrypt aes_encrypt(input string/binary, key string/binary) - Encrypt input using AES.
AES (Advanced Encryption Standard) algorithm. Key lengths of 128, 192 or 256 bits can be used. 192 and 256 bits keys can be used if Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files are installed. If either argument is NULL or the key length is not one of the permitted values, the return value is NULL.
Example: > SELECT base64(aes_encrypt('ABC', '1234567890123456'));
 'y6Ss+zCYObpCbgfWfyNWTw=='
and a1 and a2 and ... and an - Logical and
array array(n0, n1...) - Creates an array with the given elements 
array_contains array_contains(array, value) - Returns TRUE if the array contains value.
Example:
  > SELECT array_contains(array(1, 2, 3), 2) FROM src LIMIT 1;
  true


以上是关于HIVE全部函数详解的主要内容,如果未能解决你的问题,请参考以下文章

大数据入门第十一天——hive详解hive函数

Hive函数详解与案列实战

详解 HiveUDF 函数

hive自定义UDF函数,步骤详解

hive之UDF函数编程详解

大数据技术-hive窗口函数详解