hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject [2/2] hive git commit: HIVE-10428 : NPE in RegexSerDe using HCat (Jason Dere via Ashutosh Chauhan)
Date Wed, 29 Apr 2015 20:06:17 GMT
HIVE-10428 : NPE in RegexSerDe using HCat (Jason Dere via Ashutosh Chauhan)

Signed-off-by: Ashutosh Chauhan <hashutosh@apache.org>


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

Branch: refs/heads/master
Commit: 31591bf1833fb3858c599addbe53aa57ac381ba4
Parents: aaa112d
Author: Jason Dere <jdere@apache.org>
Authored: Tue Apr 28 13:05:00 2015 -0700
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Wed Apr 29 13:05:48 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hive/hcatalog/mapreduce/InternalUtil.java |  2 ++
 .../org/apache/hadoop/hive/metastore/MetaStoreUtils.java | 11 +++++++++++
 .../java/org/apache/hadoop/hive/serde2/SerDeUtils.java   |  1 +
 3 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/31591bf1/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
----------------------------------------------------------------------
diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
index 9b97939..3100181 100644
--- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
+++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
@@ -164,6 +164,8 @@ class InternalUtil {
       MetaStoreUtils.getColumnNamesFromFieldSchema(fields));
     props.setProperty(org.apache.hadoop.hive.serde.serdeConstants.LIST_COLUMN_TYPES,
       MetaStoreUtils.getColumnTypesFromFieldSchema(fields));
+    props.setProperty("columns.comments",
+      MetaStoreUtils.getColumnCommentsFromFieldSchema(fields));
 
     // setting these props to match LazySimpleSerde
     props.setProperty(org.apache.hadoop.hive.serde.serdeConstants.SERIALIZATION_NULL_FORMAT,
"\\N");

http://git-wip-us.apache.org/repos/asf/hive/blob/31591bf1/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
index b89b07a..38dc406 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
@@ -1115,6 +1115,17 @@ public class MetaStoreUtils {
     return sb.toString();
   }
 
+  public static String getColumnCommentsFromFieldSchema(List<FieldSchema> fieldSchemas)
{
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < fieldSchemas.size(); i++) {
+      if (i > 0) {
+        sb.append(SerDeUtils.COLUMN_COMMENTS_DELIMITER);
+      }
+      sb.append(fieldSchemas.get(i).getComment());
+    }
+    return sb.toString();
+  }
+
   public static void makeDir(Path path, HiveConf hiveConf) throws MetaException {
     FileSystem fs;
     try {

http://git-wip-us.apache.org/repos/asf/hive/blob/31591bf1/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
index c2649b4..8dada5a 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
@@ -62,6 +62,7 @@ public final class SerDeUtils {
   public static final char QUOTE = '"';
   public static final char COLON = ':';
   public static final char COMMA = ',';
+  public static final char COLUMN_COMMENTS_DELIMITER = '\0';
   public static final String LBRACKET = "[";
   public static final String RBRACKET = "]";
   public static final String LBRACE = "{";


Mime
View raw message