Repository: hive
Updated Branches:
  refs/heads/branch-2.0 454ada627 -> 3af572599


HIVE-12863: fix test failure for TestMiniTezCliDriver.testCliDriver_tez_union 
(Pengcheng Xiong, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/branch-2.0
Commit: 3af57259906afa38d4781fed4a8a876ebe00b89a
Parents: 454ada6
Author: Pengcheng Xiong <pxi...@apache.org>
Authored: Mon Jan 18 16:27:23 2016 -0800
Committer: Pengcheng Xiong <pxi...@apache.org>
Committed: Mon Jan 18 16:28:58 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hive/metastore/hbase/HBaseStore.java  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/3af57259/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
----------------------------------------------------------------------
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
index 98e6c75..75f377a 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
@@ -263,6 +263,7 @@ public class HBaseStore implements RawStore {
       Table tblCopy = tbl.deepCopy();
       
tblCopy.setDbName(HiveStringUtils.normalizeIdentifier(tblCopy.getDbName()));
       
tblCopy.setTableName(HiveStringUtils.normalizeIdentifier(tblCopy.getTableName()));
+      normalizeColumnNames(tblCopy);
       getHBase().putTable(tblCopy);
       commit = true;
     } catch (IOException e) {
@@ -273,6 +274,24 @@ public class HBaseStore implements RawStore {
     }
   }
 
+  private void normalizeColumnNames(Table tbl) {
+    if (tbl.getSd().getCols() != null) {
+      tbl.getSd().setCols(normalizeFieldSchemaList(tbl.getSd().getCols()));
+    }
+    if (tbl.getPartitionKeys() != null) {
+      tbl.setPartitionKeys(normalizeFieldSchemaList(tbl.getPartitionKeys()));
+    }
+  }
+
+  private List<FieldSchema> normalizeFieldSchemaList(List<FieldSchema> 
fieldschemas) {
+    List<FieldSchema> ret = new ArrayList<>();
+    for (FieldSchema fieldSchema : fieldschemas) {
+      ret.add(new 
FieldSchema(HiveStringUtils.normalizeIdentifier(fieldSchema.getName()),
+          fieldSchema.getType(), fieldSchema.getComment()));
+    }
+    return ret;
+  }
+
   @Override
   public boolean dropTable(String dbName, String tableName) throws 
MetaException,
       NoSuchObjectException, InvalidObjectException, InvalidInputException {

Reply via email to