Hive常用函数有哪些

发布时间:2021-12-10 10:34:37 作者:小新
来源:亿速云 阅读:119

小编给大家分享一下Hive常用函数有哪些,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

1

   

数学函数


  • round(double d)

  • round(double d,int n)

  • floor(double d)

  • ceil(double d)

  • ceiling(double d)

  • rand() 

  • rand(int seed)

  • exp(double d)

  • ln(double d)

  • log10(double d)

  • log2(double d)

  • log(double base,double d)

  • pow(double d,double p)

  • power(double d,double p)

  • sqrt(double d)

  • hex(bigint i)

  • hex(string str)

  • abs(double d)

  • PI()


2

   

集合函数


  • size(Map<K.V>)

  • map_keys(Map<K.V>)

  • map_values(Map<K.V>)

  • array_contains(Array<T>, value)

  • sort_array(Array<T>)


3

   

类型转换函数


  • cast(expr as <type>)


4

   

日期函数


  • date_add

  • date_sub

  • next_day

  • last_day

  • from_unixtime(bigint unixtime, string format)

  • to_date(string timestamp)

  • year(string date)

  • month(string date)

  • hour(string date)

  • weekofyear(string date)

  • datediff(string enddate, string startdate)

  • add_months(string start_date, int num_months)

  • date_format(date/timestamp/string ts, string fmt)


5

   

条件函数


  • if(boolean testCondition, T valueTrue, T valueFalseOrNull)

  • nvl(T value, T default_value)

  • COALESCE(T v1, T v2, ...)

  • CASE a WHEN b THEN c [WHEN d THEN e]* [ELSE f] END

  • isnull( a )

  • isnotnull ( a )


6

   

字符函数


  • concat(string|binary A, string|binary B...)

  • concat_ws(string SEP, string A, string B...)

  • length(string A)

  • lower(string A) lcase(string A)

  • parse_url(string urlString, string partToExtract [, string keyToExtract])

  • regexp_replace(string INITIAL_STRING, string PATTERN, string REPLACEMENT)

  • reverse(string A)

  • split(string str, string pat)

  • substr(string|binary A, int start) substring(string|binary A, int start)


7

   

聚合函数


  • count(*)

  • count(expr)

  • count(distinct expr[,expr_.])

  • sum(col)

  • sum(distinct col)

  • avg(col)

  • avg(distinct col)

  • min(col)

  • max(col)


8

   

表生成函数


  • explode(ARRAY array)

  • explode(MAP map)

  • explode(ARRAY<TYPE> a)

  • json_tuple(STRING jsonStr,p1p2,…,pn)-

  • parse_url_tuple(url,partname1,partname2,…,partnameN)

以上是“Hive常用函数有哪些”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. Oracle常用函数有哪些
  2. Mysql中常用函数有什么

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

hive

上一篇:大数据中如何管理我们的建模项目文件

下一篇:怎么快速搭建Spark开发环境

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》