如何计算impala查询中的nan项?

bf1o4zei  于 2021-06-26  发布在  Impala
关注(0)|答案(2)|浏览(833)

我有一个表,在一个双精度字段中有'nan'。我只想数一数有多少项是'nan':

Select count(*) from table
where col = 'NaN'

analysisexception:double和string类型的操作数不可比较:col='nan'

Select count(*) from table
where col is null

结果=0(顺便说一句,此列中有成吨的nan记录)

Select count(*) from table
where cast(col as string) = 'NaN'

结果=0
我该怎么做,它将实际计数行?

bbmckpt7

bbmckpt71#

您可以使用is\u nan函数

select count(*) from table
where is_nan(col)
ldioqlga

ldioqlga2#

我将把nans转换成字符串,然后与 'nan' ```
Select count(*) from table
where cast(col as string) = 'nan'

相关问题