1. 程式人生 > >Spark SQL 支援的Hive內建函式

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

參考連結: