You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error:
Caused by: java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject
at com.twitter.elephantbird.pig.piggybank.JsonStringToMap.parseStringToMap(JsonStringToMap.java:63)
at com.twitter.elephantbird.pig.piggybank.JsonStringToMap.exec(JsonStringToMap.java:53)
Error:
Caused by: java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject
at com.twitter.elephantbird.pig.piggybank.JsonStringToMap.parseStringToMap(JsonStringToMap.java:63)
at com.twitter.elephantbird.pig.piggybank.JsonStringToMap.exec(JsonStringToMap.java:53)
Possible Reason:
protected Map<String, String> parseStringToMap(String line) {
try {
Map<String, String> values = Maps.newHashMap();
_JSONObject jsonObj = (JSONObject) jsonParser.parse(line);_
i.e. Since it is trying to cast JSONArray to JSONObject, it fails.
Eg. Input:
[{"discountLevel":"SUBTOTAL","itemIDs":["2523445"]},{"discountLevel":"SUBTOTAL","itemIDs":["1119882"]}]
My Pig Script:
a = FOREACH applied GENERATE JsonStringToMap(input);
Some googling led me here : https://groups.google.com/forum/#!topic/elephantbird-dev/mxCcAh4WEXY
Similar?
The text was updated successfully, but these errors were encountered: