0
我试着用下面的查询,这些查询只给出空值的计数,我需要的是做一个空检查并返回列名。如何从Hive表中获取列名,如果该列包含空值?
select count(*)-count(columnA), count(*)-count(columnB) from table;
select count(*) from table where columnA is null;
我试着用下面的查询,这些查询只给出空值的计数,我需要的是做一个空检查并返回列名。如何从Hive表中获取列名,如果该列包含空值?
select count(*)-count(columnA), count(*)-count(columnB) from table;
select count(*) from table where columnA is null;
你也可以做
SELECT
SUM(IF(columnA is NULL,1,0)) as canulls,
SUM(IF(columnB is NULL,1,0)) as cbnulls
FROM table;
这也会给你的每个列空字段数。