hive中on以及distinct中出现null的解决办法
distinct字段出现null
1.distinct 中字段出现null时,会使得计算结果不准确。原因有1. 所有的null值会被归并到一项;2. count结果并不会统计null项
SELECT DISTINCT id, value FROM table;
2.可以使用coalesce函数解决
SELECT DISTINCT(coalesce(ID, 0), coalesce(value, 0)) FROM table;
3.关于distinct 与group by
disticnt会让所有数据sh
原创
2021-04-06 19:25:06 ·
2210 阅读 ·
0 评论