简体   繁体   English

如何仅在 hive 中获取具有 NULL 值的所有列的列表?

[英]How to get the list of all columns having NULL values only in hive?

I am working on a huge data set having more than 10k rows and more than 600 columns in Hive .我正在处理一个庞大的数据集,在Hive中有超过 10k 行和超过 600 列。 There are multiple rows columns which having NULL value for all the rows.有多个行列,所有行的NULL值。 How can I get the list of all the columns having only NULL values?如何获取只有NULL值的所有列的列表?

Use count(col) to count all NOT NULL rows for some column.使用count(col)计算某些列的所有NOT NULL行。

Columns with all NULL s will have 0 counts:所有NULL的列将有0个计数:

select
count(col1) as col1_cnt,
count(col2) as col2_cnt,
...
count(colN) as colN_cnt

from table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM