I have a UDF to output JSON. (PIG v0.9.1, Hadoop 0.20.204)
I have tested the setup outside of pig and Jackson will produce a JSON
string.
However in the UDF I am getting:
ERROR 2997: Unable to recreate exception from backed error: Error:
org.codehaus.jackson.map.ObjectMapper.writeValueAsString(Ljava/lang/Object;)Ljava/lang/String;
in the putNext(Tuple t) function:
the aky object is POJO, and I have tested the hardcoded setup (which is
also used in the UDF for now) in a separate Java main block it eliminate
the extreme obvious.
I have tried to rethrow a PigException to get some idea of which exception
is causing the issue.
ObjectMapper mapper = new ObjectMapper();
String jsonOutput = null;
try {
jsonOutput = mapper.writeValueAsString(aky);
Text text = new Text(jsonOutput);
writer.write(null, text);
} catch (JsonGenerationException e) {
e.printStackTrace();
throw new PigException(e);
} catch (JsonMappingException e) {
e.printStackTrace();
throw new PigException(e);
} catch (IOException e) {
e.printStackTrace();
throw new PigException(e);
}
Anyway to determine the actual exception or the root cause?
thanks,
rob