Search code examples
apache-pig

How to get rid of \N from pig result


preview of what I am supposed to change, replace the \N with () with empty string

enter image description here

 d = FOREACH result GENERATE REPLACE(REPLACE(EFF_DT,'\N','');

enter image description here

so essentially if it's a valid date should be left alone, if its \N it should get rid of \N and supposed to show () but it obviously comes up as (\). Just wondering why this isn't working like it supposed to. I tried the bottom one as well no help.

d = FOREACH result GENERATE REPLACE(REPLACE(EFF_DT,'\N',''),'\',''));

Solution

  • Both \ and N are special characters here. Try this,

     d = FOREACH result GENERATE REPLACE(EFF_DT,'\\\\N','');