You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by sh...@apache.org on 2015/10/23 00:32:37 UTC

[1/2] incubator-hawq git commit: HAWQ-53. Fix to handling nulls in complex data types in avro via pxf

Repository: incubator-hawq
Updated Branches:
  refs/heads/master d89788de7 -> b10897824


HAWQ-53. Fix to handling nulls in complex data types in avro via pxf


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/098e241d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/098e241d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/098e241d

Branch: refs/heads/master
Commit: 098e241db115d8cd9fa3f710f546fb300afe9db0
Parents: 7ad8950
Author: Shivram Mani <sh...@gmail.com>
Authored: Wed Oct 21 15:44:21 2015 -0700
Committer: Shivram Mani <sh...@gmail.com>
Committed: Wed Oct 21 15:44:21 2015 -0700

----------------------------------------------------------------------
 .../pivotal/pxf/plugins/hdfs/AvroResolver.java   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/098e241d/pxf/pxf-hdfs/src/main/java/com/pivotal/pxf/plugins/hdfs/AvroResolver.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hdfs/src/main/java/com/pivotal/pxf/plugins/hdfs/AvroResolver.java b/pxf/pxf-hdfs/src/main/java/com/pivotal/pxf/plugins/hdfs/AvroResolver.java
index 8b86479..5249877 100644
--- a/pxf/pxf-hdfs/src/main/java/com/pivotal/pxf/plugins/hdfs/AvroResolver.java
+++ b/pxf/pxf-hdfs/src/main/java/com/pivotal/pxf/plugins/hdfs/AvroResolver.java
@@ -161,22 +161,31 @@ public class AvroResolver extends Plugin implements ReadResolver {
 
         Schema.Type fieldType = fieldSchema.getType();
         int ret = 0;
-        Object value;
+        Object value = fieldValue;
 
         switch (fieldType) {
             case ARRAY:
+                if(fieldValue == null) {
+                    return addOneFieldToRecord(record, TEXT, fieldValue);
+                }
                 List<OneField> listRecord = new LinkedList<>();
                 ret = setArrayField(listRecord, fieldValue, fieldSchema);
                 addOneFieldToRecord(record, TEXT, String.format("[%s]",
                         HdfsUtilities.toString(listRecord, collectionDelim)));
                 break;
             case MAP:
+                if(fieldValue == null) {
+                    return addOneFieldToRecord(record, TEXT, fieldValue);
+                }
                 List<OneField> mapRecord = new LinkedList<>();
                 ret = setMapField(mapRecord, fieldValue, fieldSchema);
                 addOneFieldToRecord(record, TEXT, String.format("{%s}",
                         HdfsUtilities.toString(mapRecord, collectionDelim)));
                 break;
             case RECORD:
+                if(fieldValue == null) {
+                    return addOneFieldToRecord(record, TEXT, fieldValue);
+                }
                 List<OneField> recRecord = new LinkedList<>();
                 ret = setRecordField(recRecord, fieldValue, fieldSchema);
                 addOneFieldToRecord(record, TEXT, String.format("{%s}",
@@ -201,15 +210,12 @@ public class AvroResolver extends Plugin implements ReadResolver {
                         fieldSchema.getTypes().get(unionIndex));
                 break;
             case ENUM:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, TEXT, value);
                 break;
             case INT:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, INTEGER, value);
                 break;
             case DOUBLE:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, FLOAT8, value);
                 break;
             case STRING:
@@ -218,23 +224,18 @@ public class AvroResolver extends Plugin implements ReadResolver {
                 ret = addOneFieldToRecord(record, TEXT, value);
                 break;
             case FLOAT:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, REAL, value);
                 break;
             case LONG:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, BIGINT, value);
                 break;
             case BYTES:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, BYTEA, value);
                 break;
             case BOOLEAN:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, BOOLEAN, value);
                 break;
             case FIXED:
-                value = (fieldValue != null) ? fieldValue : null;
                 ret = addOneFieldToRecord(record, BYTEA, value);
                 break;
             default:


[2/2] incubator-hawq git commit: Merge branch 'HAWQ-53'

Posted by sh...@apache.org.
Merge branch 'HAWQ-53'


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b1089782
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b1089782
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b1089782

Branch: refs/heads/master
Commit: b108978244d32bb271d85318e6caee5c2bf62d9a
Parents: d89788d 098e241
Author: Shivram Mani <sh...@gmail.com>
Authored: Thu Oct 22 15:33:56 2015 -0700
Committer: Shivram Mani <sh...@gmail.com>
Committed: Thu Oct 22 15:33:56 2015 -0700

----------------------------------------------------------------------
 .../pivotal/pxf/plugins/hdfs/AvroResolver.java   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------