val
和coalesce效果一样只不过val不是标准得函数。
coalesce
coalesce(exp1,exp2,exp3....)
从一系列数中获取第一个不为null值得数
case
case
when exp1 is not null then exp1
when exp2 is not null then exp2
when exp3 is not null then exp3
else null
end
和上边的coalesce效果一样
nullif
nullif(exp1,exp2)
判断两个数是否相等如果相等返回null值,如果不相等返回第一个值
hive求去年这个时候得30天前日期
add_months(date_sub(current_date, 30), -12)