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
Post a Comment