Hive面試題:hive有哪些udf函式,作用
UDF(user-defined function)作用於單個數據行,產生一個數據行作為輸出。(數學函式,字串函式)
UDAF(使用者定義聚集函式 User- Defined Aggregation Funcation):接收多個輸入資料行,併產生一個輸出資料行。(count,max)
UDTF(表格生成函式 User-Defined Table Functions):接收一行輸入,輸出(explode)
1. 個數統計函式: count
2. 總和統計函式: sum
3. 平均值統計函式: avg
4. 最小值統計函式: min
5. 最大值統計函式: max
6. 非空集合總體變數函式: var_pop
7. 非空集合樣本變數函式: var_samp
8. 總體標準偏離函式: stddev_pop
9. 樣本標準偏離函式: stddev_samp
10.中位數函式: percentile
11. 中位數函式: percentile
12. 近似中位數函式: percentile_approx
13. 近似中位數函式: percentile_approx
14. 直方圖: histogram_numeric
15. 集合去重數:collect_set
16. 集合不去重函式:collect_list
表格生成函式 Table-Generating Functions (UDTF)
1. 陣列拆分成多行:explode(array)
2. Map 拆分成多行:explode(map)