JSON splitter fails when an excepted field is not present in JSON
Reported by gmarabout (at gmail) | March 31st, 2009 @ 12:43 PM
The following code assume that the field "phone" is always present, which is not necessarily the case in JSON:
assembly = new Each(assembly, new Fields("line"), jsonSplitter, new Fields("name", "age", "phones"));
It fails with:
cascading.pipe.OperatorException: [json_flatten][cascading.utils.json.operation.JSONFlattenTestCase.testJSONFlatten(JSONFlattenTestCase.java:23)] operator Each failed executing operation
at cascading.pipe.Each$EachHandler.operate(Each.java:413)
at cascading.flow.stack.EachMapperStackElement.operateEach(EachMapperStackElement.java:86)
at cascading.flow.stack.EachMapperStackElement.collect(EachMapperStackElement.java:79)
at cascading.flow.stack.FlowMapperStack.map(FlowMapperStack.java:165)
at cascading.flow.FlowMapper.map(FlowMapper.java:77)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:138)
Caused by: cascading.flow.stack.StackException: cascading.pipe.OperatorException: [json_flatten][cascading.utils.json.operation.JSONFlattenTestCase.testJSONFlatten(JSONFlattenTestCase.java:26)] operator Each failed executing operation
at cascading.flow.stack.StackElement.handleException(StackElement.java:95)
at cascading.flow.stack.StackElement.handleException(StackElement.java:86)
at cascading.flow.stack.EachMapperStackElement.operateEach(EachMapperStackElement.java:90)
at cascading.flow.stack.EachMapperStackElement.collect(EachMapperStackElement.java:79)
at cascading.pipe.Each$EachFunctionHandler$1.collect(Each.java:459)
at cascading.tuple.TupleEntryCollector.add(TupleEntryCollector.java:71)
at cascading.utils.json.operation.JSONSplitter.operate(JSONSplitter.java:40)
at cascading.pipe.Each.applyFunction(Each.java:312)
at cascading.pipe.Each.access$200(Each.java:50)
at cascading.pipe.Each$EachFunctionHandler.handle(Each.java:470)
at cascading.pipe.Each$EachHandler.operate(Each.java:405)
... 7 more
Caused by: cascading.pipe.OperatorException: [json_flatten][cascading.utils.json.operation.JSONFlattenTestCase.testJSONFlatten(JSONFlattenTestCase.java:26)] operator Each failed executing operation
at cascading.pipe.Each$EachHandler.operate(Each.java:413)
at cascading.flow.stack.EachMapperStackElement.operateEach(EachMapperStackElement.java:86)
... 15 more
Caused by: java.lang.NullPointerException
at cascading.utils.json.JSONUtils.getJSON(JSONUtils.java:30)
at cascading.utils.json.operation.JSONFlatten.operate(JSONFlatten.java:27)
at cascading.pipe.Each.applyFunction(Each.java:312)
at cascading.pipe.Each.access$200(Each.java:50)
at cascading.pipe.Each$EachFunctionHandler.handle(Each.java:470)
at cascading.pipe.Each$EachHandler.operate(Each.java:405)
... 16 more
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป