hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khorg...@apache.org
Subject hive git commit: HIVE-11470 : NPE in DynamicPartFileRecordWriterContainer on null part-keys (Mithun Radhakrishnan via Sushanth Sowmyan)
Date Tue, 09 Feb 2016 01:10:17 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2.0 82fd4a1de -> 4357f130c


HIVE-11470 : NPE in DynamicPartFileRecordWriterContainer on null part-keys (Mithun Radhakrishnan
via Sushanth Sowmyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4357f130
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4357f130
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4357f130

Branch: refs/heads/branch-2.0
Commit: 4357f130ca0d1bb139a73d50c981de715971213c
Parents: 82fd4a1
Author: Sushanth Sowmyan <khorgath@gmail.com>
Authored: Thu Jan 21 14:48:46 2016 -0800
Committer: Sushanth Sowmyan <khorgath@gmail.com>
Committed: Mon Feb 8 17:10:03 2016 -0800

----------------------------------------------------------------------
 .../mapreduce/DynamicPartitionFileRecordWriterContainer.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/4357f130/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/DynamicPartitionFileRecordWriterContainer.java
----------------------------------------------------------------------
diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/DynamicPartitionFileRecordWriterContainer.java
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/DynamicPartitionFileRecordWriterContainer.java
index 320ace4..a7c9f29 100644
--- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/DynamicPartitionFileRecordWriterContainer.java
+++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/DynamicPartitionFileRecordWriterContainer.java
@@ -62,6 +62,8 @@ class DynamicPartitionFileRecordWriterContainer extends FileRecordWriterContaine
   private final Map<String, ObjectInspector> dynamicObjectInspectors;
   private Map<String, OutputJobInfo> dynamicOutputJobInfo;
 
+  private String HIVE_DEFAULT_PARTITION_VALUE = null;
+
   /**
    * @param baseWriter RecordWriter to contain
    * @param context current TaskAttemptContext
@@ -86,6 +88,7 @@ class DynamicPartitionFileRecordWriterContainer extends FileRecordWriterContaine
     this.dynamicContexts = new HashMap<String, org.apache.hadoop.mapred.TaskAttemptContext>();
     this.dynamicObjectInspectors = new HashMap<String, ObjectInspector>();
     this.dynamicOutputJobInfo = new HashMap<String, OutputJobInfo>();
+    this.HIVE_DEFAULT_PARTITION_VALUE = HiveConf.getVar(context.getConfiguration(), HiveConf.ConfVars.DEFAULTPARTITIONNAME);
   }
 
   @Override
@@ -136,7 +139,8 @@ class DynamicPartitionFileRecordWriterContainer extends FileRecordWriterContaine
     // be done before we delete cols.
     List<String> dynamicPartValues = new ArrayList<String>();
     for (Integer colToAppend : dynamicPartCols) {
-      dynamicPartValues.add(value.get(colToAppend).toString());
+      Object partitionValue = value.get(colToAppend);
+      dynamicPartValues.add(partitionValue == null? HIVE_DEFAULT_PARTITION_VALUE : partitionValue.toString());
     }
 
     String dynKey = dynamicPartValues.toString();


Mime
View raw message