Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:rcongiu/Hive-JSON-Serde

  • Loading branch information...
commit 89101b7371f2c6aa2a9a983e699496abd10e1564 2 parents 740cb29 + 2503566
Roberto Congiu authored
View
1  README.txt
@@ -104,6 +104,7 @@ Versions:
1.0: initial release
1.1: fixed some string issues
1.1.1 (2012/07/03): fixed Map Adapter (get and put would call themselves...ooops)
+1.1.2 (2012/07/26): Fixed issue with columns that are not mapped into JSON, reported by Michael Phung
View
2  pom.xml
@@ -5,7 +5,7 @@
<groupId>org.openx.data</groupId>
<artifactId>json-serde</artifactId>
- <version>1.1.1</version>
+ <version>1.1.2</version>
<packaging>jar</packaging>
<name>openx-json-serde</name>
View
10 src/main/java/org/openx/data/jsonserde/objectinspector/JsonStructObjectInspector.java
@@ -44,7 +44,10 @@ public Object getStructFieldData(Object data, StructField fieldRef) {
assert (fieldID >= 0 && fieldID < fields.size());
try {
- return obj.get(f.getFieldName());
+ if(obj.has(f.getFieldName()))
+ return obj.get(f.getFieldName());
+ else
+ return null;
} catch (JSONException ex) {
// if key does not exist
return null;
@@ -59,7 +62,10 @@ public Object getStructFieldData(Object data, StructField fieldRef) {
for (int i = 0; i < fields.size(); i++) {
try {
- values.add(jObj.get(fields.get(i).getFieldName()));
+ if (jObj.has(fields.get(i).getFieldName()))
+ values.add(jObj.get(fields.get(i).getFieldName()));
+ else
+ values.add(null);
} catch (JSONException ex) {
// we're iterating through the keys so
// this should never happen
Please sign in to comment.
Something went wrong with that request. Please try again.