HIVE-20185: Backport HIVE-20111 to branch-3 (Daniel Voros via Zoltan Haindrich)
Signed-off-by: Zoltan Haindrich <k...@rxd.hu> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/c7386550 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/c7386550 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/c7386550 Branch: refs/heads/branch-3 Commit: c7386550e8e3815845006d6b9674363bb591d76a Parents: 150ef3b Author: Daniel Voros <daniel.vo...@gmail.com> Authored: Mon Jul 30 10:28:55 2018 +0200 Committer: Zoltan Haindrich <k...@rxd.hu> Committed: Mon Jul 30 10:28:55 2018 +0200 ---------------------------------------------------------------------- .../apache/hadoop/hive/hbase/HBaseMetaHook.java | 56 +++++++-------- .../src/test/queries/negative/cascade_dbdrop.q | 4 +- .../generatehfiles_require_family_path.q | 5 +- .../src/test/queries/negative/hbase_ddl.q | 4 +- .../test/queries/positive/external_table_ppd.q | 5 +- .../test/queries/positive/hbase_binary_binary.q | 5 +- .../queries/positive/hbase_binary_map_queries.q | 13 ++-- .../positive/hbase_binary_map_queries_prefix.q | 9 +-- .../positive/hbase_binary_storage_queries.q | 12 ++-- .../test/queries/positive/hbase_custom_key.q | 5 +- .../test/queries/positive/hbase_custom_key2.q | 5 +- .../test/queries/positive/hbase_custom_key3.q | 5 +- .../src/test/queries/positive/hbase_ddl.q | 4 +- .../queries/positive/hbase_decimal_decimal.q | 5 +- .../test/queries/positive/hbase_handler_bulk.q | 11 ++- .../src/test/queries/positive/hbase_joins.q | 25 ++++--- .../queries/positive/hbase_null_first_col.q | 5 +- .../src/test/queries/positive/hbase_ppd_join.q | 8 +-- .../test/queries/positive/hbase_ppd_key_range.q | 5 +- .../src/test/queries/positive/hbase_pushdown.q | 5 +- .../src/test/queries/positive/hbase_queries.q | 54 +++++++++------ .../test/queries/positive/hbase_scan_params.q | 5 +- .../hbase_single_sourced_multi_insert.q | 5 +- .../src/test/queries/positive/hbase_timestamp.q | 20 +++--- .../queries/positive/hbase_timestamp_format.q | 4 +- .../src/test/queries/positive/hbase_viewjoins.q | 10 +-- .../src/test/queries/positive/hbasestats.q | 5 +- .../src/test/queries/positive/ppd_key_ranges.q | 5 +- .../test/results/negative/cascade_dbdrop.q.out | 8 +-- .../generatehfiles_require_family_path.q.out | 6 +- .../src/test/results/negative/hbase_ddl.q.out | 8 +-- .../results/positive/external_table_ppd.q.out | 14 ++-- .../results/positive/hbase_binary_binary.q.out | 6 +- .../positive/hbase_binary_map_queries.q.out | 22 +++--- .../hbase_binary_map_queries_prefix.q.out | 14 ++-- .../positive/hbase_binary_storage_queries.q.out | 28 +++++--- .../results/positive/hbase_custom_key.q.out | 6 +- .../results/positive/hbase_custom_key2.q.out | 6 +- .../results/positive/hbase_custom_key3.q.out | 6 +- .../src/test/results/positive/hbase_ddl.q.out | 16 +++-- .../positive/hbase_decimal_decimal.q.out | Bin 1758 -> 1872 bytes .../results/positive/hbase_handler_bulk.q.out | 16 ++--- .../src/test/results/positive/hbase_joins.q.out | 30 +++++--- .../results/positive/hbase_null_first_col.q.out | 6 +- .../test/results/positive/hbase_ppd_join.q.out | 12 ++-- .../results/positive/hbase_ppd_key_range.q.out | 6 +- .../test/results/positive/hbase_pushdown.q.out | 6 +- .../test/results/positive/hbase_queries.q.out | 68 ++++++++++++------- .../results/positive/hbase_scan_params.q.out | 6 +- .../hbase_single_sourced_multi_insert.q.out | 6 +- .../test/results/positive/hbase_timestamp.q.out | 24 ++++--- .../positive/hbase_timestamp_format.q.out | 8 +-- .../test/results/positive/hbase_viewjoins.q.out | 20 +++--- .../src/test/results/positive/hbasestats.q.out | 26 +++++-- .../test/results/positive/ppd_key_ranges.q.out | 6 +- 55 files changed, 406 insertions(+), 278 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseMetaHook.java ---------------------------------------------------------------------- diff --git a/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseMetaHook.java b/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseMetaHook.java index 3565c8c..f01ed57 100644 --- a/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseMetaHook.java +++ b/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseMetaHook.java @@ -32,6 +32,8 @@ import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils; import org.apache.hadoop.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.Closeable; import java.io.IOException; @@ -44,6 +46,7 @@ import java.util.Set; * be used after usage. */ public class HBaseMetaHook implements HiveMetaHook, Closeable { + private static final Logger LOG = LoggerFactory.getLogger(HBaseMetaHook.class); private Configuration hbaseConf; private Admin admin; @@ -99,12 +102,15 @@ public class HBaseMetaHook implements HiveMetaHook, Closeable { public void commitDropTable(Table tbl, boolean deleteData) throws MetaException { try { String tableName = getHBaseTableName(tbl); - boolean isExternal = MetaStoreUtils.isExternalTable(tbl); - if (deleteData && !isExternal) { - if (getHBaseAdmin().isTableEnabled(TableName.valueOf(tableName))) { - getHBaseAdmin().disableTable(TableName.valueOf(tableName)); + boolean isPurge = !MetaStoreUtils.isExternalTable(tbl) || MetaStoreUtils.isExternalTablePurge(tbl); + if (deleteData && isPurge) { + LOG.info("Dropping with purge all the data for data source {}", tableName); + if (getHBaseAdmin().tableExists(TableName.valueOf(tableName))) { + if (getHBaseAdmin().isTableEnabled(TableName.valueOf(tableName))) { + getHBaseAdmin().disableTable(TableName.valueOf(tableName)); + } + getHBaseAdmin().deleteTable(TableName.valueOf(tableName)); } - getHBaseAdmin().deleteTable(TableName.valueOf(tableName)); } } catch (IOException ie) { throw new MetaException(StringUtils.stringifyException(ie)); @@ -113,8 +119,6 @@ public class HBaseMetaHook implements HiveMetaHook, Closeable { @Override public void preCreateTable(Table tbl) throws MetaException { - boolean isExternal = MetaStoreUtils.isExternalTable(tbl); - // We'd like to move this to HiveMetaStore for any non-native table, but // first we need to support storing NULL for location on a table if (tbl.getSd().getLocation() != null) { @@ -133,34 +137,24 @@ public class HBaseMetaHook implements HiveMetaHook, Closeable { HTableDescriptor tableDesc; if (!getHBaseAdmin().tableExists(TableName.valueOf(tableName))) { - // if it is not an external table then create one - if (!isExternal) { - // Create the column descriptors - tableDesc = new HTableDescriptor(TableName.valueOf(tableName)); - Set<String> uniqueColumnFamilies = new HashSet<String>(); - - for (ColumnMappings.ColumnMapping colMap : columnMappings) { - if (!colMap.hbaseRowKey && !colMap.hbaseTimestamp) { - uniqueColumnFamilies.add(colMap.familyName); - } - } + // create table from Hive + // create the column descriptors + tableDesc = new HTableDescriptor(TableName.valueOf(tableName)); + Set<String> uniqueColumnFamilies = new HashSet<String>(); - for (String columnFamily : uniqueColumnFamilies) { - tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes(columnFamily))); + for (ColumnMappings.ColumnMapping colMap : columnMappings) { + if (!colMap.hbaseRowKey && !colMap.hbaseTimestamp) { + uniqueColumnFamilies.add(colMap.familyName); } + } - getHBaseAdmin().createTable(tableDesc); - } else { - // an external table - throw new MetaException("HBase table " + tableName + - " doesn't exist while the table is declared as an external table."); + for (String columnFamily : uniqueColumnFamilies) { + tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes(columnFamily))); } + getHBaseAdmin().createTable(tableDesc); } else { - if (!isExternal) { - throw new MetaException("Table " + tableName + " already exists within HBase; " - + "use CREATE EXTERNAL TABLE instead to register it in Hive."); - } + // register table in Hive // make sure the schema mapping is right tableDesc = getHBaseAdmin().getTableDescriptor(TableName.valueOf(tableName)); @@ -190,10 +184,10 @@ public class HBaseMetaHook implements HiveMetaHook, Closeable { @Override public void rollbackCreateTable(Table table) throws MetaException { - boolean isExternal = MetaStoreUtils.isExternalTable(table); String tableName = getHBaseTableName(table); + boolean isPurge = !MetaStoreUtils.isExternalTable(table) || MetaStoreUtils.isExternalTablePurge(table); try { - if (!isExternal && getHBaseAdmin().tableExists(TableName.valueOf(tableName))) { + if (isPurge && getHBaseAdmin().tableExists(TableName.valueOf(tableName))) { // we have created an HBase table, so we delete it to roll back; if (getHBaseAdmin().isTableEnabled(TableName.valueOf(tableName))) { getHBaseAdmin().disableTable(TableName.valueOf(tableName)); http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/negative/cascade_dbdrop.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/negative/cascade_dbdrop.q b/hbase-handler/src/test/queries/negative/cascade_dbdrop.q index 7f9df5e..99e36ac 100644 --- a/hbase-handler/src/test/queries/negative/cascade_dbdrop.q +++ b/hbase-handler/src/test/queries/negative/cascade_dbdrop.q @@ -11,10 +11,10 @@ CREATE DATABASE hbaseDB; -- Exit Code < 0 on syntax/usage error -- Exit Code > 0 operation failed -CREATE TABLE hbaseDB.hbase_table_0(key int, value string) +CREATE EXTERNAL TABLE hbaseDB.hbase_table_0(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0"); +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true"); dfs -ls target/tmp/hbase/data/default/hbase_table_0; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/negative/generatehfiles_require_family_path.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/negative/generatehfiles_require_family_path.q b/hbase-handler/src/test/queries/negative/generatehfiles_require_family_path.q index 6844fbc..ceb9390 100644 --- a/hbase-handler/src/test/queries/negative/generatehfiles_require_family_path.q +++ b/hbase-handler/src/test/queries/negative/generatehfiles_require_family_path.q @@ -2,9 +2,10 @@ DROP TABLE IF EXISTS hbase_bulk; -CREATE TABLE hbase_bulk (key INT, value STRING) +CREATE EXTERNAL TABLE hbase_bulk (key INT, value STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,cf:string'); +WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,cf:string') +TBLPROPERTIES ("external.table.purge" = "true"); SET hive.hbase.generatehfiles = true; INSERT OVERWRITE TABLE hbase_bulk SELECT * FROM src CLUSTER BY key; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/negative/hbase_ddl.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/negative/hbase_ddl.q b/hbase-handler/src/test/queries/negative/hbase_ddl.q index 2913bcd..24f684c 100644 --- a/hbase-handler/src/test/queries/negative/hbase_ddl.q +++ b/hbase-handler/src/test/queries/negative/hbase_ddl.q @@ -1,8 +1,8 @@ DROP TABLE hbase_table_1; -CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0"); +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true"); DESCRIBE EXTENDED hbase_table_1; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/external_table_ppd.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/external_table_ppd.q b/hbase-handler/src/test/queries/positive/external_table_ppd.q index fbef4bb..3c10cd1 100644 --- a/hbase-handler/src/test/queries/positive/external_table_ppd.q +++ b/hbase-handler/src/test/queries/positive/external_table_ppd.q @@ -1,6 +1,6 @@ DROP TABLE t_hbase; -CREATE TABLE t_hbase(key STRING, +CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -11,7 +11,8 @@ CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:binarykey#-,cf:binarybyte#-,cf:binaryshort#-,:key#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary"); + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true"); DESCRIBE FORMATTED t_hbase; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_binary_binary.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_binary_binary.q b/hbase-handler/src/test/queries/positive/hbase_binary_binary.q index 388e5aa..7c17ca2 100644 --- a/hbase-handler/src/test/queries/positive/hbase_binary_binary.q +++ b/hbase-handler/src/test/queries/positive/hbase_binary_binary.q @@ -1,9 +1,10 @@ drop table if exists testhbaseb; -CREATE TABLE testhbaseb (key int, val binary) +CREATE EXTERNAL TABLE testhbaseb (key int, val binary) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,cf:val#b" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); insert into table testhbaseb values(1, 'hello'); insert into table testhbaseb values(2, 'hi'); select * from testhbaseb; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_binary_map_queries.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_binary_map_queries.q b/hbase-handler/src/test/queries/positive/hbase_binary_map_queries.q index 255a2c7..af3ee4f 100644 --- a/hbase-handler/src/test/queries/positive/hbase_binary_map_queries.q +++ b/hbase-handler/src/test/queries/positive/hbase_binary_map_queries.q @@ -1,13 +1,14 @@ DROP TABLE hbase_src; -CREATE TABLE hbase_src(key STRING, +CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, bigint_col BIGINT, float_col FLOAT, double_col DOUBLE, - string_col STRING); + string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_src SELECT key, key, key, key, key, key, key, value @@ -16,7 +17,7 @@ INSERT OVERWRITE TABLE hbase_src DROP TABLE t_hbase_maps; -CREATE TABLE t_hbase_maps(key STRING, +CREATE EXTERNAL TABLE t_hbase_maps(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -27,7 +28,7 @@ CREATE TABLE t_hbase_maps(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-tinyint:,cf-smallint:,cf-int:,cf-bigint:,cf-float:,cf-double:,cf-string:,cf-boolean:") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps"); +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true"); INSERT OVERWRITE TABLE t_hbase_maps SELECT key, @@ -118,7 +119,7 @@ DROP TABLE t_ext_hbase_maps_2; DROP TABLE t_hbase_maps_1; -CREATE TABLE t_hbase_maps_1(key STRING, +CREATE EXTERNAL TABLE t_hbase_maps_1(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -129,7 +130,7 @@ CREATE TABLE t_hbase_maps_1(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key#b,cf-tinyint:#b:b,cf-smallint:#b:b,cf-int:#b:b,cf-bigint:#b:b,cf-float:#b:b,cf-double:#b:b,cf-string:#b:b,cf-boolean:#b:b") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1"); +TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1", "external.table.purge" = "true"); INSERT OVERWRITE TABLE t_hbase_maps_1 SELECT key, http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_binary_map_queries_prefix.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_binary_map_queries_prefix.q b/hbase-handler/src/test/queries/positive/hbase_binary_map_queries_prefix.q index 9ff4366..ead792b 100644 --- a/hbase-handler/src/test/queries/positive/hbase_binary_map_queries_prefix.q +++ b/hbase-handler/src/test/queries/positive/hbase_binary_map_queries_prefix.q @@ -1,13 +1,14 @@ DROP TABLE hbase_src; -CREATE TABLE hbase_src(key STRING, +CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, bigint_col BIGINT, float_col FLOAT, double_col DOUBLE, - string_col STRING); + string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_src SELECT key, key, key, key, key, key, key, value @@ -16,12 +17,12 @@ INSERT OVERWRITE TABLE hbase_src DROP TABLE t_hbase_maps; -CREATE TABLE t_hbase_maps(key STRING, +CREATE EXTERNAL TABLE t_hbase_maps(key STRING, string_map_col MAP<STRING, STRING>, simple_string_col STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-string:,cf-string:simple_string_col") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps"); +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true"); INSERT OVERWRITE TABLE t_hbase_maps SELECT key, http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_binary_storage_queries.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_binary_storage_queries.q b/hbase-handler/src/test/queries/positive/hbase_binary_storage_queries.q index b048871..4e62e0f 100644 --- a/hbase-handler/src/test/queries/positive/hbase_binary_storage_queries.q +++ b/hbase-handler/src/test/queries/positive/hbase_binary_storage_queries.q @@ -1,6 +1,6 @@ DROP TABLE t_hbase; -CREATE TABLE t_hbase(key STRING, +CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -11,7 +11,8 @@ CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary"); + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true"); DESCRIBE FORMATTED t_hbase; @@ -92,7 +93,7 @@ DROP TABLE t_hbase_1; DROP TABLE t_hbase; DROP TABLE t_hbase_2; -CREATE TABLE t_hbase_2(key STRING, +CREATE EXTERNAL TABLE t_hbase_2(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -102,7 +103,7 @@ CREATE TABLE t_hbase_2(key STRING, boolean_col BOOLEAN) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") -TBLPROPERTIES ("hbase.table.name" = "t_hive_2"); +TBLPROPERTIES ("hbase.table.name" = "t_hive_2", "external.table.purge" = "true"); INSERT OVERWRITE TABLE t_hbase_2 SELECT 'user1', 1, 1, 1, 1, 1.0, 1.0, true @@ -191,7 +192,8 @@ STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ( "hbase.table.name" = "t_hive_2", -"hbase.table.default.storage.type" = "binary"); +"hbase.table.default.storage.type" = "binary", +"external.table.purge" = "true"); SELECT * FROM t_hbase_4; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_custom_key.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_custom_key.q b/hbase-handler/src/test/queries/positive/hbase_custom_key.q index 9dbb2a0..7456027 100644 --- a/hbase-handler/src/test/queries/positive/hbase_custom_key.q +++ b/hbase-handler/src/test/queries/positive/hbase_custom_key.q @@ -1,9 +1,10 @@ -CREATE TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) +CREATE EXTERNAL TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom", "hbase.columns.mapping" = ":key,cf:string", - "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory"); + "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory") +TBLPROPERTIES ("external.table.purge" = "true"); CREATE EXTERNAL TABLE hbase_ck_2(key string, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_custom_key2.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_custom_key2.q b/hbase-handler/src/test/queries/positive/hbase_custom_key2.q index 9fba4f6..f11fb4d 100644 --- a/hbase-handler/src/test/queries/positive/hbase_custom_key2.q +++ b/hbase-handler/src/test/queries/positive/hbase_custom_key2.q @@ -1,9 +1,10 @@ -CREATE TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) +CREATE EXTERNAL TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom2", "hbase.columns.mapping" = ":key,cf:string", - "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory2"); + "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory2") +TBLPROPERTIES ("external.table.purge" = "true"); from src tablesample (5 rows) insert into table hbase_ck_4 select http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_custom_key3.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_custom_key3.q b/hbase-handler/src/test/queries/positive/hbase_custom_key3.q index 22d2c9e..0bc773a 100644 --- a/hbase-handler/src/test/queries/positive/hbase_custom_key3.q +++ b/hbase-handler/src/test/queries/positive/hbase_custom_key3.q @@ -1,9 +1,10 @@ -CREATE TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) +CREATE EXTERNAL TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom3", "hbase.columns.mapping" = ":key,cf:string", - "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory3"); + "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory3") +TBLPROPERTIES ("external.table.purge" = "true"); from src tablesample (5 rows) insert into table hbase_ck_5 select http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_ddl.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_ddl.q b/hbase-handler/src/test/queries/positive/hbase_ddl.q index a8bae75..37f7f61 100644 --- a/hbase-handler/src/test/queries/positive/hbase_ddl.q +++ b/hbase-handler/src/test/queries/positive/hbase_ddl.q @@ -1,8 +1,8 @@ DROP TABLE hbase_table_1; -CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0"); +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true"); DESCRIBE EXTENDED hbase_table_1; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_decimal_decimal.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_decimal_decimal.q b/hbase-handler/src/test/queries/positive/hbase_decimal_decimal.q index d943fbd..016f10b 100644 --- a/hbase-handler/src/test/queries/positive/hbase_decimal_decimal.q +++ b/hbase-handler/src/test/queries/positive/hbase_decimal_decimal.q @@ -1,11 +1,12 @@ -CREATE TABLE testhbase_decimal ( +CREATE EXTERNAL TABLE testhbase_decimal ( id int, balance decimal(15,2)) ROW FORMAT DELIMITED COLLECTION ITEMS TERMINATED BY '~' STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( -"hbase.columns.mapping"=":key,cf:balance#b"); +"hbase.columns.mapping"=":key,cf:balance#b") +TBLPROPERTIES ("external.table.purge" = "true"); insert into testhbase_decimal values (1,1), (2, 2.2), (3, 33.33); http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q b/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q index d02a61f..159574d 100644 --- a/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q +++ b/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q @@ -3,10 +3,10 @@ drop table if exists hb_target; -- this is the target HBase table -create table hb_target(key int, val string) +create external table hb_target(key int, val string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties ('hbase.columns.mapping' = ':key,cf:val') -tblproperties ('hbase.table.name' = 'positive_hbase_handler_bulk'); +tblproperties ('hbase.table.name' = 'positive_hbase_handler_bulk', 'external.table.purge' = 'true'); set hive.hbase.generatehfiles=true; set hfile.family.path=/tmp/hb_target/cf; @@ -27,10 +27,10 @@ drop table hb_target; dfs -rmr /tmp/hb_target/cf; -create table hb_target(key int, val string) +create external table hb_target(key int, val string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties ('hbase.columns.mapping' = ':key,cf:val') -tblproperties ('hbase.table.name' = 'positive_hbase_handler_bulk'); +tblproperties ('hbase.table.name' = 'positive_hbase_handler_bulk', 'external.table.purge' = 'true'); -- do it twice - regression test for HIVE-18607 @@ -42,6 +42,3 @@ insert overwrite table hb_target select distinct key, value from src cluster by drop table hb_target; dfs -rmr /tmp/hb_target/cf; - - - http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_joins.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_joins.q b/hbase-handler/src/test/queries/positive/hbase_joins.q index 1616adc..815e0e3 100644 --- a/hbase-handler/src/test/queries/positive/hbase_joins.q +++ b/hbase-handler/src/test/queries/positive/hbase_joins.q @@ -5,23 +5,26 @@ DROP TABLE users_level; -- From HIVE-1257 -CREATE TABLE users(key string, state string, country string, country_id int) +CREATE EXTERNAL TABLE users(key string, state string, country string, country_id int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "info:state,info:country,info:country_id" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); -CREATE TABLE states(key string, name string) +CREATE EXTERNAL TABLE states(key string, name string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "state:name" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); -CREATE TABLE countries(key string, name string, country string, country_id int) +CREATE EXTERNAL TABLE countries(key string, name string, country string, country_id int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "info:name,info:country,info:country_id" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE users SELECT 'user1', 'IA', 'USA', 0 FROM src WHERE key=100; @@ -64,13 +67,15 @@ DROP TABLE users; DROP TABLE states; DROP TABLE countries; -CREATE TABLE users(key int, userid int, username string, created int) +CREATE EXTERNAL TABLE users(key int, userid int, username string, created int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,f:userid,f:nickname,f:created"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,f:userid,f:nickname,f:created") +TBLPROPERTIES ("external.table.purge" = "true"); -CREATE TABLE users_level(key int, userid int, level int) +CREATE EXTERNAL TABLE users_level(key int, userid int, level int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,f:userid,f:level"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,f:userid,f:level") +TBLPROPERTIES ("external.table.purge" = "true"); -- HIVE-1903: the problem fixed here showed up even without any data, -- so no need to load any to test it http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_null_first_col.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_null_first_col.q b/hbase-handler/src/test/queries/positive/hbase_null_first_col.q index 0d9ff56..5c5c311 100644 --- a/hbase-handler/src/test/queries/positive/hbase_null_first_col.q +++ b/hbase-handler/src/test/queries/positive/hbase_null_first_col.q @@ -4,11 +4,12 @@ DROP TABLE hbase_null; CREATE TABLE src_null(a STRING, b STRING, c STRING, d STRING) STORED AS TEXTFILE; LOAD DATA LOCAL INPATH '../../data/files/null.txt' INTO TABLE src_null; -CREATE TABLE hbase_null(key string, col1 string, col2 string) +CREATE EXTERNAL TABLE hbase_null(key string, col1 string, col2 string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,cf1:c1,cf1:c2" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); SELECT d, a, c FROM src_null; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_ppd_join.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_ppd_join.q b/hbase-handler/src/test/queries/positive/hbase_ppd_join.q index 2436c19..94a397c 100644 --- a/hbase-handler/src/test/queries/positive/hbase_ppd_join.q +++ b/hbase-handler/src/test/queries/positive/hbase_ppd_join.q @@ -4,11 +4,11 @@ drop table if exists hive1_tbl_data_hbase2; drop view if exists hive1_view_data_hbase1; drop view if exists hive1_view_data_hbase2; -CREATE TABLE hive1_tbl_data_hbase1 (COLUMID string,COLUMN_FN string,COLUMN_LN string,EMAIL string,COL_UPDATED_DATE timestamp, PK_COLUM string) +CREATE EXTERNAL TABLE hive1_tbl_data_hbase1 (COLUMID string,COLUMN_FN string,COLUMN_LN string,EMAIL string,COL_UPDATED_DATE timestamp, PK_COLUM string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES("hbase.columns.mapping" = "default:COLUMID,default:COLUMN_FN,default:COLUMN_LN,default:EMAIL,default:COL_UPDATED_DATE,:key" ) -; +TBLPROPERTIES ("external.table.purge" = "true"); --create hive view for the above hive table 1 CREATE VIEW hive1_view_data_hbase1 @@ -25,11 +25,11 @@ AND COL_UPDATED_DATE IS NOT NULL insert into table hive1_tbl_data_hbase1 select '00001','john','doe','j...@hotmail.com','2014-01-01 12:01:02','4000-10000' from src where key = 100; --create hive hbase table 2 -CREATE TABLE hive1_tbl_data_hbase2 (COLUMID string,COLUMN_FN string,COLUMN_LN string,EMAIL string,COL_UPDATED_DATE timestamp, PK_COLUM string) +CREATE EXTERNAL TABLE hive1_tbl_data_hbase2 (COLUMID string,COLUMN_FN string,COLUMN_LN string,EMAIL string,COL_UPDATED_DATE timestamp, PK_COLUM string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES("hbase.columns.mapping" = "default:COLUMID,default:COLUMN_FN,default:COLUMN_LN,default:EMAIL,default:COL_UPDATED_DATE,:key" ) -; +TBLPROPERTIES ("external.table.purge" = "true"); --create hive view for the above hive hbase table 2 CREATE VIEW hive1_view_data_hbase2 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_ppd_key_range.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_ppd_key_range.q b/hbase-handler/src/test/queries/positive/hbase_ppd_key_range.q index 59e724d..ffba3f5 100644 --- a/hbase-handler/src/test/queries/positive/hbase_ppd_key_range.q +++ b/hbase-handler/src/test/queries/positive/hbase_ppd_key_range.q @@ -1,6 +1,7 @@ -CREATE TABLE hbase_pushdown(key string, value string) +CREATE EXTERNAL TABLE hbase_pushdown(key string, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string") +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_pushdown SELECT cast(key as string), value http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_pushdown.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_pushdown.q b/hbase-handler/src/test/queries/positive/hbase_pushdown.q index 0d29c82..24c1fac 100644 --- a/hbase-handler/src/test/queries/positive/hbase_pushdown.q +++ b/hbase-handler/src/test/queries/positive/hbase_pushdown.q @@ -1,6 +1,7 @@ -CREATE TABLE hbase_pushdown(key int, value string) +CREATE EXTERNAL TABLE hbase_pushdown(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string") +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_pushdown SELECT * http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/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 4604f3e..6c3d7cd 100644 --- a/hbase-handler/src/test/queries/positive/hbase_queries.q +++ b/hbase-handler/src/test/queries/positive/hbase_queries.q @@ -1,8 +1,8 @@ DROP TABLE hbase_table_1; -CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0"); +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true"); DESCRIBE EXTENDED hbase_table_1; @@ -52,9 +52,10 @@ ON (x.key = Y.key) ORDER BY key,value; DROP TABLE empty_hbase_table; -CREATE TABLE empty_hbase_table(key int, value string) +CREATE EXTERNAL TABLE empty_hbase_table(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") +TBLPROPERTIES ("external.table.purge" = "true"); DROP TABLE empty_normal_table; CREATE TABLE empty_normal_table(key int, value string); @@ -64,11 +65,12 @@ select * from (select count(1) c from empty_normal_table union all select count( select * from (select count(1) c from src union all select count(1) as c from empty_hbase_table) x order by c; select * from (select count(1) c from src union all select count(1) as c from hbase_table_1) x order by c; -CREATE TABLE hbase_table_3(key int, value string, count int) +CREATE EXTERNAL TABLE hbase_table_3(key int, value string, count int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "cf:val,cf2:count" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); EXPLAIN INSERT OVERWRITE TABLE hbase_table_3 @@ -92,11 +94,12 @@ select * from hbase_table_3 order by key, value limit 5; select key, count from hbase_table_3 order by key, count desc limit 5; DROP TABLE hbase_table_4; -CREATE TABLE hbase_table_4(key int, value1 string, value2 int, value3 int) +CREATE EXTERNAL TABLE hbase_table_4(key int, value1 string, value2 int, value3 int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "a:b,a:c,d:e" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_table_4 SELECT key, value, key+1, key+2 FROM src WHERE key=98 OR key=100; @@ -112,22 +115,24 @@ TBLPROPERTIES ("hbase.table.name" = "hbase_table_4"); SELECT * FROM hbase_table_5 ORDER BY key; DROP TABLE hbase_table_6; -CREATE TABLE hbase_table_6(key int, value map<string,string>) +CREATE EXTERNAL TABLE hbase_table_6(key int, value map<string,string>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,cf:" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_table_6 SELECT key, map(value, key) FROM src WHERE key=98 OR key=100; SELECT * FROM hbase_table_6 ORDER BY key; DROP TABLE hbase_table_7; -CREATE TABLE hbase_table_7(value map<string,string>, key int) +CREATE EXTERNAL TABLE hbase_table_7(value map<string,string>, key int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "cf:,:key" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_table_7 SELECT map(value, key, upper(value), key+1), key FROM src WHERE key=98 OR key=100; @@ -137,11 +142,12 @@ SELECT * FROM hbase_table_7 ORDER BY key; set hive.hbase.wal.enabled=false; DROP TABLE hbase_table_8; -CREATE TABLE hbase_table_8(key int, value1 string, value2 int, value3 int) +CREATE EXTERNAL TABLE hbase_table_8(key int, value1 string, value2 int, value3 int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "a:b,a:c,d:e" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_table_8 SELECT key, value, key+1, key+2 FROM src WHERE key=98 OR key=100; @@ -165,9 +171,10 @@ SELECT COUNT(*) FROM hbase_table_1_like; SHOW CREATE TABLE hbase_table_1_like; DROP TABLE IF EXISTS hbase_table_9; -CREATE TABLE hbase_table_9 (id bigint, data map<string, string>, str string) +CREATE EXTERNAL TABLE hbase_table_9 (id bigint, data map<string, string>, str string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -with serdeproperties ("hbase.columns.mapping" = ":key,cf:map_col#s:s,cf:str_col"); +with serdeproperties ("hbase.columns.mapping" = ":key,cf:map_col#s:s,cf:str_col") +TBLPROPERTIES ("external.table.purge" = "true"); insert overwrite table hbase_table_9 select 1 as id, map('abcd', null) as data , null as str from src limit 1; insert into table hbase_table_9 select 2 as id, map('efgh', null) as data , '1234' as str from src limit 1; @@ -177,9 +184,10 @@ insert into table hbase_table_9 select 5 as id, map('key1',null, 'key2', 'avalue select * from hbase_table_9; DROP TABLE IF EXISTS hbase_table_10; -CREATE TABLE hbase_table_10 (id bigint, data map<int, int>, str string) +CREATE EXTERNAL TABLE hbase_table_10 (id bigint, data map<int, int>, str string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -with serdeproperties ("hbase.columns.mapping" = ":key,cf:map_col2,cf:str2_col"); +with serdeproperties ("hbase.columns.mapping" = ":key,cf:map_col2,cf:str2_col") +TBLPROPERTIES ("external.table.purge" = "true"); set hive.cbo.enable=false; insert overwrite table hbase_table_10 select 1 as id, map(10, cast(null as int)) as data , null as str from src limit 1; insert into table hbase_table_10 select 2 as id, map(20, cast(null as int)) as data , '1234' as str from src limit 1; @@ -190,16 +198,18 @@ select * from hbase_table_10; DROP TABLE IF EXISTS hbase_table_11; -CREATE TABLE hbase_table_11(id INT, map_column STRUCT<s_int:INT,s_string:STRING,s_date:DATE>) +CREATE EXTERNAL TABLE hbase_table_11(id INT, map_column STRUCT<s_int:INT,s_string:STRING,s_date:DATE>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,id:id'); +WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,id:id') +TBLPROPERTIES ("external.table.purge" = "true"); INSERT INTO hbase_table_11 SELECT 2,NAMED_STRUCT("s_int",CAST(NULL AS INT),"s_string","s1","s_date",CAST('2018-03-12' AS DATE)) FROM src LIMIT 1; select * from hbase_table_11; DROP TABLE IF EXISTS hbase_table_12; -CREATE TABLE hbase_table_12(id INT, list_column ARRAY <STRING>) +CREATE EXTERNAL TABLE hbase_table_12(id INT, list_column ARRAY <STRING>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,id:id'); +WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,id:id') +TBLPROPERTIES ("external.table.purge" = "true"); INSERT INTO hbase_table_12 SELECT 2, ARRAY("a", CAST (NULL AS STRING), "b") FROM src LIMIT 1; select * from hbase_table_12; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_scan_params.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_scan_params.q b/hbase-handler/src/test/queries/positive/hbase_scan_params.q index 14d7d15..7bea8f0 100644 --- a/hbase-handler/src/test/queries/positive/hbase_scan_params.q +++ b/hbase-handler/src/test/queries/positive/hbase_scan_params.q @@ -1,7 +1,8 @@ -CREATE TABLE hbase_pushdown(key int, value string) +CREATE EXTERNAL TABLE hbase_pushdown(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string", -"hbase.scan.cache" = "500", "hbase.scan.cacheblocks" = "true", "hbase.scan.batch" = "1"); +"hbase.scan.cache" = "500", "hbase.scan.cacheblocks" = "true", "hbase.scan.batch" = "1") +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_pushdown SELECT * FROM src; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_single_sourced_multi_insert.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_single_sourced_multi_insert.q b/hbase-handler/src/test/queries/positive/hbase_single_sourced_multi_insert.q index 96fec0e..4ca0297 100644 --- a/hbase-handler/src/test/queries/positive/hbase_single_sourced_multi_insert.q +++ b/hbase-handler/src/test/queries/positive/hbase_single_sourced_multi_insert.q @@ -1,8 +1,9 @@ -- HIVE-4375 Single sourced multi insert consists of native and non-native table mixed throws NPE CREATE TABLE src_x1(key string, value string); -CREATE TABLE src_x2(key string, value string) +CREATE EXTERNAL TABLE src_x2(key string, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key, cf:value"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key, cf:value") +TBLPROPERTIES ("external.table.purge" = "true"); explain from src a http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_timestamp.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_timestamp.q b/hbase-handler/src/test/queries/positive/hbase_timestamp.q index 6ae2c30..19db69d 100644 --- a/hbase-handler/src/test/queries/positive/hbase_timestamp.q +++ b/hbase-handler/src/test/queries/positive/hbase_timestamp.q @@ -1,22 +1,25 @@ DROP TABLE hbase_table; -CREATE TABLE hbase_table (key string, value string, `time` timestamp) +CREATE EXTERNAL TABLE hbase_table (key string, value string, `time` timestamp) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' - WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp"); + WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp") + TBLPROPERTIES ("external.table.purge" = "true"); DESC extended hbase_table; FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, "2012-02-23 10:14:52" WHERE (key % 17) = 0; SELECT * FROM hbase_table; DROP TABLE hbase_table; -CREATE TABLE hbase_table (key string, value string, `time` bigint) +CREATE EXTERNAL TABLE hbase_table (key string, value string, `time` bigint) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' - WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp"); + WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp") + TBLPROPERTIES ("external.table.purge" = "true"); FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754000 WHERE (key % 17) = 0; SELECT key, value, cast(`time` as timestamp) FROM hbase_table; DROP TABLE hbase_table; -CREATE TABLE hbase_table (key string, value string, `time` bigint) +CREATE EXTERNAL TABLE hbase_table (key string, value string, `time` bigint) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' - WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp"); + WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp") + TBLPROPERTIES ("external.table.purge" = "true"); insert overwrite table hbase_table select key,value,ts FROM ( select key, value, 100000000000 as ts from src WHERE (key % 33) = 0 @@ -41,9 +44,10 @@ SELECT key, value, cast(`time` as timestamp) FROM hbase_table WHERE key > 100 AN SELECT key, value, cast(`time` as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND `time` >= 200000000000; DROP TABLE hbase_table; -CREATE TABLE hbase_table(key string, value map<string, string>, `time` timestamp) +CREATE EXTERNAL TABLE hbase_table(key string, value map<string, string>, `time` timestamp) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:,:timestamp"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:,:timestamp") +TBLPROPERTIES ("external.table.purge" = "true"); FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, MAP("name", CONCAT(value, " Jr")), "2012-02-23 10:14:52" WHERE (key % 17) = 0; FROM src INSERT INTO TABLE hbase_table SELECT key, MAP("age", '40'), "2015-12-12 12:12:12" WHERE (key % 17) = 0; FROM src INSERT INTO TABLE hbase_table SELECT key, MAP("name", value), "2000-01-01 01:01:01" WHERE (key % 17) = 0; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q b/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q index a8d5501..7ed0495 100644 --- a/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q +++ b/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q @@ -1,8 +1,8 @@ -create table hbase_str(rowkey string,mytime string,mystr string) +create external table hbase_str(rowkey string,mytime string,mystr string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ('hbase.columns.mapping' = 'm:mytime,m:mystr') - TBLPROPERTIES ('hbase.table.name' = 'hbase_ts'); + TBLPROPERTIES ('hbase.table.name' = 'hbase_ts', 'external.table.purge' = 'true'); describe hbase_str; insert overwrite table hbase_str select key, '2001-02-03-04.05.06.123456', value from src limit 3; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbase_viewjoins.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbase_viewjoins.q b/hbase-handler/src/test/queries/positive/hbase_viewjoins.q index 5c98903..f18a099 100644 --- a/hbase-handler/src/test/queries/positive/hbase_viewjoins.q +++ b/hbase-handler/src/test/queries/positive/hbase_viewjoins.q @@ -2,7 +2,7 @@ DROP VIEW IF EXISTS VIEW_HBASE_TABLE_TEST_2; DROP VIEW IF EXISTS VIEW_HBASE_TABLE_TEST_1; DROP TABLE IF EXISTS HBASE_TABLE_TEST_2; DROP TABLE IF EXISTS HBASE_TABLE_TEST_1; -CREATE TABLE HBASE_TABLE_TEST_1( +CREATE EXTERNAL TABLE HBASE_TABLE_TEST_1( cvalue string , pk string, ccount int ) @@ -17,11 +17,12 @@ WITH SERDEPROPERTIES ( 'serialization.format'='1') TBLPROPERTIES ( 'hbase.table.name'='hbase_table_test_1', - 'serialization.null.format'='' ); + 'serialization.null.format'='', + 'external.table.purge' = 'true'); CREATE VIEW VIEW_HBASE_TABLE_TEST_1 AS SELECT hbase_table_test_1.cvalue,hbase_table_test_1.pk,hbase_table_test_1.ccount FROM hbase_table_test_1 WHERE hbase_table_test_1.ccount IS NOT NULL; -CREATE TABLE HBASE_TABLE_TEST_2( +CREATE EXTERNAL TABLE HBASE_TABLE_TEST_2( cvalue string , pk string , ccount int ) @@ -36,7 +37,8 @@ WITH SERDEPROPERTIES ( 'serialization.format'='1') TBLPROPERTIES ( 'hbase.table.name'='hbase_table_test_2', - 'serialization.null.format'=''); + 'serialization.null.format'='', + 'external.table.purge' = 'true'); CREATE VIEW VIEW_HBASE_TABLE_TEST_2 AS SELECT hbase_table_test_2.cvalue,hbase_table_test_2.pk,hbase_table_test_2.ccount FROM hbase_table_test_2 WHERE hbase_table_test_2.pk >='3-0000h-0' AND hbase_table_test_2.pk <= '3-0000h-g' AND http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/hbasestats.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/hbasestats.q b/hbase-handler/src/test/queries/positive/hbasestats.q index 52e11c9..98933ed 100644 --- a/hbase-handler/src/test/queries/positive/hbasestats.q +++ b/hbase-handler/src/test/queries/positive/hbasestats.q @@ -1,10 +1,11 @@ DROP TABLE users; -CREATE TABLE users(key string, state string, country string, country_id int) +CREATE EXTERNAL TABLE users(key string, state string, country string, country_id int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = "info:state,info:country,info:country_id" -); +) +TBLPROPERTIES ("external.table.purge" = "true"); desc formatted users; http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/queries/positive/ppd_key_ranges.q ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/queries/positive/ppd_key_ranges.q b/hbase-handler/src/test/queries/positive/ppd_key_ranges.q index 0497d25..186f742 100644 --- a/hbase-handler/src/test/queries/positive/ppd_key_ranges.q +++ b/hbase-handler/src/test/queries/positive/ppd_key_ranges.q @@ -1,6 +1,7 @@ -CREATE TABLE hbase_ppd_keyrange(key int, value string) +CREATE EXTERNAL TABLE hbase_ppd_keyrange(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' -WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#binary,cf:string"); +WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#binary,cf:string") +TBLPROPERTIES ("external.table.purge" = "true"); INSERT OVERWRITE TABLE hbase_ppd_keyrange SELECT * http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out b/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out index cef7a06..803e35e 100644 --- a/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out +++ b/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out @@ -4,17 +4,17 @@ PREHOOK: Output: database:hbaseDB POSTHOOK: query: CREATE DATABASE hbaseDB POSTHOOK: type: CREATEDATABASE POSTHOOK: Output: database:hbaseDB -PREHOOK: query: CREATE TABLE hbaseDB.hbase_table_0(key int, value string) +PREHOOK: query: CREATE EXTERNAL TABLE hbaseDB.hbase_table_0(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:hbasedb PREHOOK: Output: hbaseDB@hbase_table_0 -POSTHOOK: query: CREATE TABLE hbaseDB.hbase_table_0(key int, value string) +POSTHOOK: query: CREATE EXTERNAL TABLE hbaseDB.hbase_table_0(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:hbasedb POSTHOOK: Output: hbaseDB@hbase_table_0 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/negative/generatehfiles_require_family_path.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/negative/generatehfiles_require_family_path.q.out b/hbase-handler/src/test/results/negative/generatehfiles_require_family_path.q.out index 52ac38f..aab4cf9 100644 --- a/hbase-handler/src/test/results/negative/generatehfiles_require_family_path.q.out +++ b/hbase-handler/src/test/results/negative/generatehfiles_require_family_path.q.out @@ -2,15 +2,17 @@ PREHOOK: query: DROP TABLE IF EXISTS hbase_bulk PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE IF EXISTS hbase_bulk POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE hbase_bulk (key INT, value STRING) +PREHOOK: query: CREATE EXTERNAL TABLE hbase_bulk (key INT, value STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,cf:string') +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_bulk -POSTHOOK: query: CREATE TABLE hbase_bulk (key INT, value STRING) +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_bulk (key INT, value STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,cf:string') +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_bulk http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/negative/hbase_ddl.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/negative/hbase_ddl.q.out b/hbase-handler/src/test/results/negative/hbase_ddl.q.out index fde2fc5..e4c146b 100644 --- a/hbase-handler/src/test/results/negative/hbase_ddl.q.out +++ b/hbase-handler/src/test/results/negative/hbase_ddl.q.out @@ -2,17 +2,17 @@ PREHOOK: query: DROP TABLE hbase_table_1 PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE hbase_table_1 POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +PREHOOK: query: CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_table_1 -POSTHOOK: query: CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_table_1 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/external_table_ppd.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/external_table_ppd.q.out b/hbase-handler/src/test/results/positive/external_table_ppd.q.out index aed43cf..6832920 100644 --- a/hbase-handler/src/test/results/positive/external_table_ppd.q.out +++ b/hbase-handler/src/test/results/positive/external_table_ppd.q.out @@ -2,7 +2,7 @@ PREHOOK: query: DROP TABLE t_hbase PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -13,11 +13,12 @@ PREHOOK: query: CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:binarykey#-,cf:binarybyte#-,cf:binaryshort#-,:key#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary") + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase -POSTHOOK: query: CREATE TABLE t_hbase(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -28,7 +29,8 @@ POSTHOOK: query: CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:binarykey#-,cf:binarybyte#-,cf:binaryshort#-,:key#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary") + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase @@ -53,10 +55,12 @@ Database: default #### A masked pattern was here #### Retention: 0 #### A masked pattern was here #### -Table Type: MANAGED_TABLE +Table Type: EXTERNAL_TABLE Table Parameters: COLUMN_STATS_ACCURATE {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"bigint_col\":\"true\",\"boolean_col\":\"true\",\"double_col\":\"true\",\"float_col\":\"true\",\"int_col\":\"true\",\"key\":\"true\",\"smallint_col\":\"true\",\"tinyint_col\":\"true\"}} + EXTERNAL TRUE bucketing_version 2 + external.table.purge true hbase.table.default.storage.type binary hbase.table.name t_hive numFiles 0 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_binary_binary.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_binary_binary.q.out b/hbase-handler/src/test/results/positive/hbase_binary_binary.q.out index e04227f..debe89c 100644 --- a/hbase-handler/src/test/results/positive/hbase_binary_binary.q.out +++ b/hbase-handler/src/test/results/positive/hbase_binary_binary.q.out @@ -2,19 +2,21 @@ PREHOOK: query: drop table if exists testhbaseb PREHOOK: type: DROPTABLE POSTHOOK: query: drop table if exists testhbaseb POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE testhbaseb (key int, val binary) +PREHOOK: query: CREATE EXTERNAL TABLE testhbaseb (key int, val binary) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,cf:val#b" ) +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@testhbaseb -POSTHOOK: query: CREATE TABLE testhbaseb (key int, val binary) +POSTHOOK: query: CREATE EXTERNAL TABLE testhbaseb (key int, val binary) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,cf:val#b" ) +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@testhbaseb http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_binary_map_queries.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_binary_map_queries.q.out b/hbase-handler/src/test/results/positive/hbase_binary_map_queries.q.out index feaca4b..57fea2c 100644 --- a/hbase-handler/src/test/results/positive/hbase_binary_map_queries.q.out +++ b/hbase-handler/src/test/results/positive/hbase_binary_map_queries.q.out @@ -2,7 +2,7 @@ PREHOOK: query: DROP TABLE hbase_src PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE hbase_src POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE hbase_src(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -10,10 +10,11 @@ PREHOOK: query: CREATE TABLE hbase_src(key STRING, float_col FLOAT, double_col DOUBLE, string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_src -POSTHOOK: query: CREATE TABLE hbase_src(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -21,6 +22,7 @@ POSTHOOK: query: CREATE TABLE hbase_src(key STRING, float_col FLOAT, double_col DOUBLE, string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_src @@ -50,7 +52,7 @@ PREHOOK: query: DROP TABLE t_hbase_maps PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase_maps POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase_maps(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -61,11 +63,11 @@ PREHOOK: query: CREATE TABLE t_hbase_maps(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-tinyint:,cf-smallint:,cf-int:,cf-bigint:,cf-float:,cf-double:,cf-string:,cf-boolean:") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase_maps -POSTHOOK: query: CREATE TABLE t_hbase_maps(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -76,7 +78,7 @@ POSTHOOK: query: CREATE TABLE t_hbase_maps(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-tinyint:,cf-smallint:,cf-int:,cf-bigint:,cf-float:,cf-double:,cf-string:,cf-boolean:") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase_maps @@ -314,7 +316,7 @@ PREHOOK: query: DROP TABLE t_hbase_maps_1 PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase_maps_1 POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase_maps_1(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps_1(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -325,11 +327,11 @@ PREHOOK: query: CREATE TABLE t_hbase_maps_1(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key#b,cf-tinyint:#b:b,cf-smallint:#b:b,cf-int:#b:b,cf-bigint:#b:b,cf-float:#b:b,cf-double:#b:b,cf-string:#b:b,cf-boolean:#b:b") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase_maps_1 -POSTHOOK: query: CREATE TABLE t_hbase_maps_1(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps_1(key STRING, tinyint_map_col MAP<TINYINT, TINYINT>, smallint_map_col MAP<SMALLINT, SMALLINT>, int_map_col MAP<INT, INT>, @@ -340,7 +342,7 @@ POSTHOOK: query: CREATE TABLE t_hbase_maps_1(key STRING, boolean_map_col MAP<BOOLEAN, BOOLEAN>) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key#b,cf-tinyint:#b:b,cf-smallint:#b:b,cf-int:#b:b,cf-bigint:#b:b,cf-float:#b:b,cf-double:#b:b,cf-string:#b:b,cf-boolean:#b:b") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps_1", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase_maps_1 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_binary_map_queries_prefix.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_binary_map_queries_prefix.q.out b/hbase-handler/src/test/results/positive/hbase_binary_map_queries_prefix.q.out index f6432b3..946d722 100644 --- a/hbase-handler/src/test/results/positive/hbase_binary_map_queries_prefix.q.out +++ b/hbase-handler/src/test/results/positive/hbase_binary_map_queries_prefix.q.out @@ -2,7 +2,7 @@ PREHOOK: query: DROP TABLE hbase_src PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE hbase_src POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE hbase_src(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -10,10 +10,11 @@ PREHOOK: query: CREATE TABLE hbase_src(key STRING, float_col FLOAT, double_col DOUBLE, string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_src -POSTHOOK: query: CREATE TABLE hbase_src(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_src(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -21,6 +22,7 @@ POSTHOOK: query: CREATE TABLE hbase_src(key STRING, float_col FLOAT, double_col DOUBLE, string_col STRING) +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_src @@ -50,21 +52,21 @@ PREHOOK: query: DROP TABLE t_hbase_maps PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase_maps POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase_maps(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps(key STRING, string_map_col MAP<STRING, STRING>, simple_string_col STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-string:,cf-string:simple_string_col") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase_maps -POSTHOOK: query: CREATE TABLE t_hbase_maps(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase_maps(key STRING, string_map_col MAP<STRING, STRING>, simple_string_col STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping"=":key,cf-string:,cf-string:simple_string_col") -TBLPROPERTIES ("hbase.table.name"="t_hive_maps") +TBLPROPERTIES ("hbase.table.name"="t_hive_maps", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase_maps http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out b/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out index 172db75..1209c88 100644 --- a/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out +++ b/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out @@ -2,7 +2,7 @@ PREHOOK: query: DROP TABLE t_hbase PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -13,11 +13,12 @@ PREHOOK: query: CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary") + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase -POSTHOOK: query: CREATE TABLE t_hbase(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -28,7 +29,8 @@ POSTHOOK: query: CREATE TABLE t_hbase(key STRING, STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ("hbase.table.name" = "t_hive", - "hbase.table.default.storage.type" = "binary") + "hbase.table.default.storage.type" = "binary", + "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase @@ -53,10 +55,12 @@ Database: default #### A masked pattern was here #### Retention: 0 #### A masked pattern was here #### -Table Type: MANAGED_TABLE +Table Type: EXTERNAL_TABLE Table Parameters: COLUMN_STATS_ACCURATE {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"bigint_col\":\"true\",\"boolean_col\":\"true\",\"double_col\":\"true\",\"float_col\":\"true\",\"int_col\":\"true\",\"key\":\"true\",\"smallint_col\":\"true\",\"tinyint_col\":\"true\"}} + EXTERNAL TRUE bucketing_version 2 + external.table.purge true hbase.table.default.storage.type binary hbase.table.name t_hive numFiles 0 @@ -338,7 +342,7 @@ PREHOOK: query: DROP TABLE t_hbase_2 PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE t_hbase_2 POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE t_hbase_2(key STRING, +PREHOOK: query: CREATE EXTERNAL TABLE t_hbase_2(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -348,11 +352,11 @@ PREHOOK: query: CREATE TABLE t_hbase_2(key STRING, boolean_col BOOLEAN) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") -TBLPROPERTIES ("hbase.table.name" = "t_hive_2") +TBLPROPERTIES ("hbase.table.name" = "t_hive_2", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase_2 -POSTHOOK: query: CREATE TABLE t_hbase_2(key STRING, +POSTHOOK: query: CREATE EXTERNAL TABLE t_hbase_2(key STRING, tinyint_col TINYINT, smallint_col SMALLINT, int_col INT, @@ -362,7 +366,7 @@ POSTHOOK: query: CREATE TABLE t_hbase_2(key STRING, boolean_col BOOLEAN) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") -TBLPROPERTIES ("hbase.table.name" = "t_hive_2") +TBLPROPERTIES ("hbase.table.name" = "t_hive_2", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase_2 @@ -586,7 +590,8 @@ STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ( "hbase.table.name" = "t_hive_2", -"hbase.table.default.storage.type" = "binary") +"hbase.table.default.storage.type" = "binary", +"external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@t_hbase_4 @@ -602,7 +607,8 @@ STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key#-,cf:binarybyte#-,cf:binaryshort#-,cf:binaryint#-,cf:binarylong#-,cf:binaryfloat#-,cf:binarydouble#-,cf:binaryboolean#-") TBLPROPERTIES ( "hbase.table.name" = "t_hive_2", -"hbase.table.default.storage.type" = "binary") +"hbase.table.default.storage.type" = "binary", +"external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@t_hbase_4 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_custom_key.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_custom_key.q.out b/hbase-handler/src/test/results/positive/hbase_custom_key.q.out index e5bc947..bd3bfcf 100644 --- a/hbase-handler/src/test/results/positive/hbase_custom_key.q.out +++ b/hbase-handler/src/test/results/positive/hbase_custom_key.q.out @@ -1,18 +1,20 @@ -PREHOOK: query: CREATE TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) +PREHOOK: query: CREATE EXTERNAL TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory") +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_ck_1 -POSTHOOK: query: CREATE TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_ck_1(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory") +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_ck_1 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_custom_key2.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_custom_key2.q.out b/hbase-handler/src/test/results/positive/hbase_custom_key2.q.out index 5d381e7..8355a43 100644 --- a/hbase-handler/src/test/results/positive/hbase_custom_key2.q.out +++ b/hbase-handler/src/test/results/positive/hbase_custom_key2.q.out @@ -1,18 +1,20 @@ -PREHOOK: query: CREATE TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) +PREHOOK: query: CREATE EXTERNAL TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom2", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory2") +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_ck_4 -POSTHOOK: query: CREATE TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_ck_4(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom2", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory2") +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_ck_4 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_custom_key3.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_custom_key3.q.out b/hbase-handler/src/test/results/positive/hbase_custom_key3.q.out index 1b042fd..6878190 100644 --- a/hbase-handler/src/test/results/positive/hbase_custom_key3.q.out +++ b/hbase-handler/src/test/results/positive/hbase_custom_key3.q.out @@ -1,18 +1,20 @@ -PREHOOK: query: CREATE TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) +PREHOOK: query: CREATE EXTERNAL TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom3", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory3") +TBLPROPERTIES ("external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_ck_5 -POSTHOOK: query: CREATE TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_ck_5(key struct<col1:string,col2:string,col3:string>, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.table.name" = "hbase_custom3", "hbase.columns.mapping" = ":key,cf:string", "hbase.composite.key.factory"="org.apache.hadoop.hive.hbase.SampleHBaseKeyFactory3") +TBLPROPERTIES ("external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_ck_5 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_ddl.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_ddl.q.out b/hbase-handler/src/test/results/positive/hbase_ddl.q.out index 9d16034..4cb2083 100644 --- a/hbase-handler/src/test/results/positive/hbase_ddl.q.out +++ b/hbase-handler/src/test/results/positive/hbase_ddl.q.out @@ -2,17 +2,17 @@ PREHOOK: query: DROP TABLE hbase_table_1 PREHOOK: type: DROPTABLE POSTHOOK: query: DROP TABLE hbase_table_1 POSTHOOK: type: DROPTABLE -PREHOOK: query: CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +PREHOOK: query: CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@hbase_table_1 -POSTHOOK: query: CREATE TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') +POSTHOOK: query: CREATE EXTERNAL TABLE hbase_table_1(key int comment 'It is a column key', value string comment 'It is the column string value') STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = "cf:string") -TBLPROPERTIES ("hbase.table.name" = "hbase_table_0") +TBLPROPERTIES ("hbase.table.name" = "hbase_table_0", "external.table.purge" = "true") POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@hbase_table_1 @@ -110,9 +110,11 @@ Database: default #### A masked pattern was here #### Retention: 0 #### A masked pattern was here #### -Table Type: MANAGED_TABLE +Table Type: EXTERNAL_TABLE Table Parameters: + EXTERNAL TRUE bucketing_version 2 + external.table.purge true hbase.mapred.output.outputtable kkk hbase.table.name hbase_table_0 #### A masked pattern was here #### @@ -157,9 +159,11 @@ Database: default #### A masked pattern was here #### Retention: 0 #### A masked pattern was here #### -Table Type: MANAGED_TABLE +Table Type: EXTERNAL_TABLE Table Parameters: + EXTERNAL TRUE bucketing_version 2 + external.table.purge true hbase.table.name hbase_table_0 #### A masked pattern was here #### numFiles 0 http://git-wip-us.apache.org/repos/asf/hive/blob/c7386550/hbase-handler/src/test/results/positive/hbase_decimal_decimal.q.out ---------------------------------------------------------------------- diff --git a/hbase-handler/src/test/results/positive/hbase_decimal_decimal.q.out b/hbase-handler/src/test/results/positive/hbase_decimal_decimal.q.out index 6bd4f73..aa9a5ac 100644 Binary files a/hbase-handler/src/test/results/positive/hbase_decimal_decimal.q.out and b/hbase-handler/src/test/results/positive/hbase_decimal_decimal.q.out differ