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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -