1. nvl

nvl(value,default_value)
空字段赋值,若value为空,则赋值default_value;若value非空,则返回原本value值。
default_value可以是数值、'字符串',也可以是字段

2. case...when...then...end

case when di_tp = '8' then '4' 
when di_tp = '1' then '1' 
else '0' end

3. concat(string1,string2...) 拼接字符串,有一个值为null则返回null

concat('hive',rand())

4. concat_ws(separator,string1,string2...)

用分隔符拼接字符串

5. collect_set / collect_list

都是列转行,将某列转为一个数组返回,区别是collect_list不去重,而collect_set去重。
collect_set(area)[0]:取去重后array里的第一个字段

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-04-08
  • 2021-10-29
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案