hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject hive git commit: HIVE-12218: Unable to create a like table for an hbase backed table (Chaoyu via Xuefu)
Date Wed, 21 Oct 2015 21:42:12 GMT
Repository: hive
Updated Branches:
  refs/heads/master 4fb94d840 -> 6293e97f0


HIVE-12218: Unable to create a like table for an hbase backed table (Chaoyu via Xuefu)


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

Branch: refs/heads/master
Commit: 6293e97f012468309a1e22a7a546f1e9d5f50ebd
Parents: 4fb94d8
Author: Xuefu Zhang <xzhang@Cloudera.com>
Authored: Wed Oct 21 14:42:00 2015 -0700
Committer: Xuefu Zhang <xzhang@Cloudera.com>
Committed: Wed Oct 21 14:42:00 2015 -0700

----------------------------------------------------------------------
 .../src/test/queries/positive/hbase_queries.q   | 16 ++++
 .../test/results/positive/hbase_queries.q.out   | 99 ++++++++++++++++++++
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java | 11 ++-
 3 files changed, 121 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/6293e97f/hbase-handler/src/test/queries/positive/hbase_queries.q
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/queries/positive/hbase_queries.q b/hbase-handler/src/test/queries/positive/hbase_queries.q
index 9ea9b1a..6ef9325 100644
--- a/hbase-handler/src/test/queries/positive/hbase_queries.q
+++ b/hbase-handler/src/test/queries/positive/hbase_queries.q
@@ -148,9 +148,25 @@ FROM src WHERE key=98 OR key=100;
 
 SELECT * FROM hbase_table_8 ORDER BY key;
 
+DROP TABLE IF EXISTS hbase_table_3_like;
+CREATE TABLE hbase_table_3_like LIKE hbase_table_3;
+DESCRIBE EXTENDED hbase_table_3_like;
+
+INSERT OVERWRITE TABLE hbase_table_3_like SELECT * FROM hbase_table_3;
+SELECT * FROM hbase_table_3_like ORDER BY key, value LIMIT 5;
+
+DROP TABLE IF EXISTS hbase_table_1_like;
+CREATE EXTERNAL TABLE hbase_table_1_like LIKE hbase_table_1;
+DESCRIBE EXTENDED hbase_table_1_like;
+
+INSERT OVERWRITE TABLE hbase_table_1_like SELECT * FROM hbase_table_1;
+SELECT COUNT(*) FROM hbase_table_1_like;
+
 DROP TABLE hbase_table_1;
+DROP TABLE hbase_table_1_like;
 DROP TABLE hbase_table_2;
 DROP TABLE hbase_table_3;
+DROP TABLE hbase_table_3_like;
 DROP TABLE hbase_table_4;
 DROP TABLE hbase_table_5;
 DROP TABLE hbase_table_6;

http://git-wip-us.apache.org/repos/asf/hive/blob/6293e97f/hbase-handler/src/test/results/positive/hbase_queries.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbase_queries.q.out b/hbase-handler/src/test/results/positive/hbase_queries.q.out
index e76169a..ce6e526 100644
--- a/hbase-handler/src/test/results/positive/hbase_queries.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_queries.q.out
@@ -816,6 +816,89 @@ POSTHOOK: Input: default@hbase_table_8
 #### A masked pattern was here ####
 98	val_98	99	100
 100	val_100	101	102
+PREHOOK: query: DROP TABLE IF EXISTS hbase_table_3_like
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS hbase_table_3_like
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE hbase_table_3_like LIKE hbase_table_3
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@hbase_table_3_like
+POSTHOOK: query: CREATE TABLE hbase_table_3_like LIKE hbase_table_3
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@hbase_table_3_like
+PREHOOK: query: DESCRIBE EXTENDED hbase_table_3_like
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: default@hbase_table_3_like
+POSTHOOK: query: DESCRIBE EXTENDED hbase_table_3_like
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: default@hbase_table_3_like
+key                 	int                 	from deserializer   
+value               	string              	from deserializer   
+count               	int                 	from deserializer   
+	 	 
+#### A masked pattern was here ####
+PREHOOK: query: INSERT OVERWRITE TABLE hbase_table_3_like SELECT * FROM hbase_table_3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hbase_table_3
+PREHOOK: Output: default@hbase_table_3_like
+POSTHOOK: query: INSERT OVERWRITE TABLE hbase_table_3_like SELECT * FROM hbase_table_3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hbase_table_3
+POSTHOOK: Output: default@hbase_table_3_like
+PREHOOK: query: SELECT * FROM hbase_table_3_like ORDER BY key, value LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hbase_table_3_like
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM hbase_table_3_like ORDER BY key, value LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hbase_table_3_like
+#### A masked pattern was here ####
+0	val_0	3
+2	val_2	1
+4	val_4	1
+8	val_8	1
+10	val_10	1
+PREHOOK: query: DROP TABLE IF EXISTS hbase_table_1_like
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS hbase_table_1_like
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE EXTERNAL TABLE hbase_table_1_like LIKE hbase_table_1
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@hbase_table_1_like
+POSTHOOK: query: CREATE EXTERNAL TABLE hbase_table_1_like LIKE hbase_table_1
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@hbase_table_1_like
+PREHOOK: query: DESCRIBE EXTENDED hbase_table_1_like
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: default@hbase_table_1_like
+POSTHOOK: query: DESCRIBE EXTENDED hbase_table_1_like
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: default@hbase_table_1_like
+key                 	int                 	from deserializer   
+value               	string              	from deserializer   
+	 	 
+#### A masked pattern was here ####
+PREHOOK: query: INSERT OVERWRITE TABLE hbase_table_1_like SELECT * FROM hbase_table_1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hbase_table_1
+PREHOOK: Output: default@hbase_table_1_like
+POSTHOOK: query: INSERT OVERWRITE TABLE hbase_table_1_like SELECT * FROM hbase_table_1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hbase_table_1
+POSTHOOK: Output: default@hbase_table_1_like
+PREHOOK: query: SELECT COUNT(*) FROM hbase_table_1_like
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hbase_table_1_like
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM hbase_table_1_like
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hbase_table_1_like
+#### A masked pattern was here ####
+155
 PREHOOK: query: DROP TABLE hbase_table_1
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@hbase_table_1
@@ -824,6 +907,14 @@ POSTHOOK: query: DROP TABLE hbase_table_1
 POSTHOOK: type: DROPTABLE
 POSTHOOK: Input: default@hbase_table_1
 POSTHOOK: Output: default@hbase_table_1
+PREHOOK: query: DROP TABLE hbase_table_1_like
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@hbase_table_1_like
+PREHOOK: Output: default@hbase_table_1_like
+POSTHOOK: query: DROP TABLE hbase_table_1_like
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@hbase_table_1_like
+POSTHOOK: Output: default@hbase_table_1_like
 PREHOOK: query: DROP TABLE hbase_table_2
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@hbase_table_2
@@ -840,6 +931,14 @@ POSTHOOK: query: DROP TABLE hbase_table_3
 POSTHOOK: type: DROPTABLE
 POSTHOOK: Input: default@hbase_table_3
 POSTHOOK: Output: default@hbase_table_3
+PREHOOK: query: DROP TABLE hbase_table_3_like
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@hbase_table_3_like
+PREHOOK: Output: default@hbase_table_3_like
+POSTHOOK: query: DROP TABLE hbase_table_3_like
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@hbase_table_3_like
+POSTHOOK: Output: default@hbase_table_3_like
 PREHOOK: query: DROP TABLE hbase_table_4
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@hbase_table_4

http://git-wip-us.apache.org/repos/asf/hive/blob/6293e97f/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index 076791f..20be624 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -213,6 +213,7 @@ import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
+import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE;
 import static org.apache.commons.lang.StringUtils.join;
 import static org.apache.hadoop.util.StringUtils.stringifyException;
 
@@ -2154,11 +2155,11 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
         tbl_row_format.append("OUTPUTFORMAT \n  '" +
             escapeHiveCommand(sd.getOutputFormat()) + "'");
       } else {
-        duplicateProps.add(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE);
+        duplicateProps.add(META_TABLE_STORAGE);
         tbl_row_format.append(" SERDE \n  '" +
             escapeHiveCommand(serdeInfo.getSerializationLib()) + "' \n");
         tbl_row_format.append("STORED BY \n  '" + escapeHiveCommand(tbl.getParameters().get(
-            org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE))
+ "' \n");
+            META_TABLE_STORAGE)) + "' \n");
         // SerDe Properties
         if (serdeInfo.getParametersSize() > 0) {
           appendSerdeParams(tbl_row_format, serdeInfo.getParameters());
@@ -3789,9 +3790,7 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
     }
 
     if (crtTbl.getStorageHandler() != null) {
-      tbl.setProperty(
-          org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE,
-          crtTbl.getStorageHandler());
+      tbl.setProperty(META_TABLE_STORAGE, crtTbl.getStorageHandler());
     }
     HiveStorageHandler storageHandler = tbl.getStorageHandler();
 
@@ -4028,6 +4027,8 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
       String paramsStr = HiveConf.getVar(conf, HiveConf.ConfVars.DDL_CTL_PARAMETERS_WHITELIST);
 
       Set<String> retainer = new HashSet<String>();
+      // for non-native table, property storage_handler should be retained
+      retainer.add(META_TABLE_STORAGE);
       if (spec != null && spec.schemaProps() != null) {
         retainer.addAll(Arrays.asList(spec.schemaProps()));
       }


Mime
View raw message