批量處理 json
json_tuple 函數
json 字段 必須是標準的
select log.字段2, 新表名.json內部字段1,新表名.json內部字段2 as sendSum
from log.表名 log
lateral view json_tuple(log.json字段屬性,'json內部字段1','json內部字段2') 新表名
as json內部字段1,json內部字段2
where dt='20200324' and ctime='2020032418'
hive 處理 null 值
當屬性不存在就取默認值
select nvl(字段名,0)from 表
hive case when
case 待判斷屬性 when ‘a’ then ‘成功’ when ‘b’ then ‘失敗’ else ‘未知’ end as ‘result’
select
case 屬性值 when 'a' then 值 when 'B' then 值 else 默認值 end as thirdPartyIds
from 表名
hive if else
if(條件,成立值,不成立值)
select if (條件,條件成立值,條件不成立值) as sendSum from 表明
hive 截取字符串
得到 k SQL,第一位爲1
SELECT substr('Spark SQL', 5)