hiveql - What is the best way to count the missing/default value rows of a column in Hive? -


select  count(column_a null or column_a '0*') num_miss_rows, count(*) num_total_rows tablex; 

is not working. because count(expr) function increments on expr returns non-null value 0.

i want compute num_miss_rows/num_total_rows, many columns.

what best way counting?

you want use case inside sum (also should like 0% not like 0*):

select  sum(case when column_a null or column_a '0%' 1 end) num_miss_rows, count(*) num_total_rows tablex; 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -