我在hive中有一个类型为double的列,但是当我这样做时,有些行是NULL:
select columnA from table;
Run Code Online (Sandbox Code Playgroud)
现在,如果我运行以下命令,则两个查询都得到0:
select count(*) from table where columnA = "NULL";
select count(*) from table where columnA = NULL;
Run Code Online (Sandbox Code Playgroud)
如何计算我的表中的行为NULL?
小智 5
在Hive中,count(*)计算所有行和count(columnA)将仅计算columnA为非NULL的行.如果您想要执行多个列,可以将查询编写为:
select count(*)-count(columnA), count(*)-count(columnB) from table;
Run Code Online (Sandbox Code Playgroud)
并获取每列中的空值数. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
| 归档时间: |
|
| 查看次数: |
11701 次 |
| 最近记录: |