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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -