简体   繁体   中英

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 . There are multiple rows columns which having NULL value for all the rows. How can I get the list of all the columns having only NULL values?

Use count(col) to count all NOT NULL rows for some column.

Columns with all NULL s will have 0 counts:

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

from table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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