Spark SQL 支持的Hive内置函数

数学函数

  • round
  • bround
  • floor
  • ceil
  • rand
  • exp
  • log
  • pow
  • sqrt
  • bin
  • hex
  • unhex
  • abs
  • pmod
  • sin
  • asin
  • cos
  • acos
  • tan
  • atan
  • degrees
  • radians
  • signum
  • factorial
  • cbrt
  • shiftleft
  • shiftright
  • shiftrightunsigned
  • greatest
  • least

集合函数

  • size
  • array_contains
  • sort_array

类型转换函数

日期函数

  • from_unixtime
  • unix_timestamp
  • to_date
  • year
  • quarter
  • month
  • dayofmonth
  • dayofyear
  • hour
  • minute
  • second
  • weekofyear
  • datediff
  • date_add
  • date_sub
  • from_utc_timestamp
  • to_utc_timestamp
  • current_date
  • current_timestamp
  • add_months
  • last_day
  • next_day
  • trunc
  • months_between
  • date_format

条件函数

  • nvl
  • COALESCE
  • when
  • isnull

字符函数

  • ascii
  • base64
  • concat
  • concat_ws
  • decode
  • encode
  • format_number
  • get_json_object
  • instr
  • length
  • locate
  • lower
  • lpad
  • ltrim
  • format_string 对应Hive中的 printf
  • regexp_extract
  • regexp_replace
  • repeat
  • reverse
  • rpad
  • rtrim
  • split
  • substring 对应Hive中的 substr
  • substring_index
  • translate
  • trim
  • unbase64
  • upper
  • initcap
  • levenshtein
  • soundex

聚合函数

  • count
  • sum
  • avg
  • min
  • max
  • variance
  • var_samp
  • stddev_pop
  • stddev_samp
  • covar_pop
  • covar_samp
  • corr

表生成函数

  • explode
  • posexplode
  • json_tuple

窗口函数

  • NTILE
  • ROW_NUMBER
  • RANK
  • DENSE_RANK
  • CUME_DIST
  • PERCENT_RANK
  • LAG
  • LEAD

参考链接:

Hive2.0函数大全

hive函数大全及使用示例

spark/sql/core/src/main/scala/org/apache/spark/sql/functions.scala

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值