Hive count(distinct c1) ,不包含NULL的总数

Posted 二十六画生的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hive count(distinct c1) ,不包含NULL的总数相关的知识,希望对你有一定的参考价值。

 Hive count(distinct c1) ,不包含NULL的总数

select count(distinct c1) from 
(
SELECT
if(1=1,null,0) as c1

union ALL
select 2 as c1 

union ALL
select 2 as c1 

union ALL
select 3 as c1 
)t0 -- 2





select count(distinct c1) from 
(
SELECT
if(1=1,null,0) as c1

union ALL

SELECT
if(2=2,null,0) as c1
)t0 -- 0

end

以上是关于Hive count(distinct c1) ,不包含NULL的总数的主要内容,如果未能解决你的问题,请参考以下文章