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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM