hive对有null值的列进行avg,sum,count操作

20191209


with tmp as
(
select null as col1
union all
select 1 as col1
union all
select 2 as col1
)
select avg(col1) avg_numm, sum(col1) sum_num, count(1) cnt, count(col1) cnt_col1
from tmp
  • 结果
1.5	3	3	2
原文地址:https://www.cnblogs.com/damahuhu/p/12009182.html