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;
這也會給你的每個列空字段數。