How to catch nan in presto?

Member

by shyann , in category: Third Party Scripts , 17 days ago

How to catch nan in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by tressie.damore , 17 days ago

@shyann 

In Presto, you can catch NaN (Not a Number) by using the IF function along with the isnan function. Here is an example of how you can catch NaN in Presto:

1
2
3
4
SELECT 
  IF(isnan(column_name), 'NaN Value', column_name) AS cleaned_column
FROM 
  table_name;


In this example, the isnan function checks if the value in column_name is NaN. If it is NaN, the IF function replaces NaN with a custom string ('NaN Value'), otherwise it keeps the original value.