HJSG
HJSG

Reputation: 41

Nan value in Impala_queries

I have a Kudu table with a column of type double, which has some values Nan. So when I perform a sum function on the table, the query outputs the value Nan. In Oracle there is a function called Nanvl which gets rid of the Nan values and does the sum function. I performed the following query:

select case 
when Column_name ='NaN' then 0
else Column_name
end
from table_name;

The above query works fine in oracle but I am getting the following error in impala-shell:

AnalysisException: operands of type DOUBLE and STRING are not comparable: column_name= 'NaN'

Upvotes: 0

Views: 3889

Answers (1)

Dzamo Norton
Dzamo Norton

Reputation: 1389

select if(is_nan(Column_name), 0, Column_name) from table_name;

Upvotes: 4

Related Questions