HIVE-null值不计数量,空字符串计数量
Posted xiaopihaierletian
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HIVE-null值不计数量,空字符串计数量相关的知识,希望对你有一定的参考价值。
结论先行:null值不计数量,空字符串计数量
SELECT
count(id) as id,
count(distinct id) as ids_id,
count(id1) as id1,
count(distinct id1) as ids_id1 ,
count(name) as name1,
count(distinct name) as ids_name1
from
(
SELECT '2' as id
union all
SELECT '3' as id
union all
SELECT '1' as id
)p1
left join
(
SELECT '1' as id1,'' as name
union all
SELECT '2' as id1,'a' as name
)p2
on p1.id = p2.id1
结果如下
结果:null值不计数量,空字符串计数量
以上是关于HIVE-null值不计数量,空字符串计数量的主要内容,如果未能解决你的问题,请参考以下文章