Hive null 值的处理

NULL值的处理
遗漏的值被代表为特殊值NULL。 要导入NULL字段的数据,需要查阅使用的SerDe的文档。 (默认的文本格式使用LazySimpleSerDe的解释字符串\ N为NULL),如将查询结果输出到文件,若为NULL,则字段值显示为\N

http://yugouai.iteye.com/blog/1849192

hive空值处理

sqoop会自动把NULL转换为null处理,但是hive中默认是把\N来表示null,因为预先处理不会生效,我们需要使用 --null-string 和 --null-non-string来处理空值 把\N转为\\N

sqoop import  ... --null-string '\\N' --null-non-string '\\N'

----------------------------------------------------------------
用if函数处理
select room,uv,pv,if(logincount is null,0,logincount) from t_result_month_room_user_stat where room in(106,167) limit 10;

猜你喜欢

转载自wangqiaowqo.iteye.com/blog/2100572