1

I am trying to convert NaN into zeroes using Pig scripting as below but I keep getting an error message. Can someone share your thoughts on how to handle NaN's in PIG.Any insights would be appreciated. Thank you.

My input field xyz::abcd has NULL,NOT NULL,NaN values in it. Need to convert all NaN's to zeroes.

xyz::abcd <> 'NaN'

(part of my code)

Teja
  • 13,214
  • 36
  • 93
  • 155

1 Answers1

1

One approach is to read the field as chararray and have a

 X = FOREACH xyz GENERATE (abcd == 'NaN' ? '0.0' : abcd);

Then you can convert your chararray to float or int or whatever.

Frederic
  • 3,274
  • 1
  • 21
  • 37