You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/07/14 04:39:13 UTC

[2/2] hive git commit: HIVE-20111: HBase-Hive (managed) table creation fails with strict managed table checks: Table is marked as a managed table but is not transactional (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

HIVE-20111: HBase-Hive (managed) table creation fails with strict managed table checks: Table is marked as a managed table but is not transactional (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/master
Commit: 3b88d6c1fd599ae3da8c781f41aee7dc2c195c83
Parents: 537c9cb
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Mon Jul 9 10:27:05 2018 -0700
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Fri Jul 13 21:38:19 2018 -0700

----------------------------------------------------------------------
 .../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/3b88d6c1/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/3b88d6c1/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 266aa06..48be8cd 100644
--- a/hbase-handler/src/test/queries/negative/cascade_dbdrop.q
+++ b/hbase-handler/src/test/queries/negative/cascade_dbdrop.q
@@ -10,10 +10,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/3b88d6c1/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 e6ff587..4e2f061 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
@@ -3,9 +3,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/3b88d6c1/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/3b88d6c1/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 c6f80cb..ed51667 100644
--- a/hbase-handler/src/test/queries/positive/external_table_ppd.q
+++ b/hbase-handler/src/test/queries/positive/external_table_ppd.q
@@ -1,7 +1,7 @@
 --! qt:dataset:src
 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,
@@ -12,7 +12,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/3b88d6c1/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/3b88d6c1/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 7d9e16e..916918d 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,14 +1,15 @@
 --! qt:dataset:src
 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
@@ -17,7 +18,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>,
@@ -28,7 +29,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,
@@ -119,7 +120,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>,
@@ -130,7 +131,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/3b88d6c1/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 c205210..c16c85a 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,14 +1,15 @@
 --! qt:dataset:src
 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
@@ -17,12 +18,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/3b88d6c1/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 86ead91..02d6ae9 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,7 +1,7 @@
 --! qt:dataset:src
 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,
@@ -12,7 +12,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;
 
@@ -93,7 +94,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,
@@ -103,7 +104,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
@@ -192,7 +193,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/3b88d6c1/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 87fbf4a..4df8d48 100644
--- a/hbase-handler/src/test/queries/positive/hbase_custom_key.q
+++ b/hbase-handler/src/test/queries/positive/hbase_custom_key.q
@@ -1,10 +1,11 @@
 --! qt:dataset:src
-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/3b88d6c1/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 5116475..462365e 100644
--- a/hbase-handler/src/test/queries/positive/hbase_custom_key2.q
+++ b/hbase-handler/src/test/queries/positive/hbase_custom_key2.q
@@ -1,10 +1,11 @@
 --! qt:dataset:src
-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/3b88d6c1/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 488a32f..106a263 100644
--- a/hbase-handler/src/test/queries/positive/hbase_custom_key3.q
+++ b/hbase-handler/src/test/queries/positive/hbase_custom_key3.q
@@ -1,10 +1,11 @@
 --! qt:dataset:src
-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/3b88d6c1/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 dcec8d6..e339a68 100644
--- a/hbase-handler/src/test/queries/positive/hbase_ddl.q
+++ b/hbase-handler/src/test/queries/positive/hbase_ddl.q
@@ -1,9 +1,9 @@
 --! qt:dataset:src
 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/3b88d6c1/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/3b88d6c1/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 1eadfce..906fc38 100644
--- a/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q
+++ b/hbase-handler/src/test/queries/positive/hbase_handler_bulk.q
@@ -4,10 +4,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;
@@ -28,10 +28,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
 
@@ -43,6 +43,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/3b88d6c1/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 7be9f6a..816a756 100644
--- a/hbase-handler/src/test/queries/positive/hbase_joins.q
+++ b/hbase-handler/src/test/queries/positive/hbase_joins.q
@@ -6,23 +6,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;
@@ -65,13 +68,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/3b88d6c1/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/3b88d6c1/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 b7e2a3b..b8e2bcb 100644
--- a/hbase-handler/src/test/queries/positive/hbase_ppd_join.q
+++ b/hbase-handler/src/test/queries/positive/hbase_ppd_join.q
@@ -5,11 +5,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 
@@ -26,11 +26,11 @@ AND COL_UPDATED_DATE IS NOT NULL
 insert into table hive1_tbl_data_hbase1 select '00001','john','doe','john@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/3b88d6c1/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 cf1d1d4..b525d8c 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,8 +1,9 @@
 --! qt:dataset:src
 --! qt:dataset:part
-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/3b88d6c1/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 8e366af..74d5ad5 100644
--- a/hbase-handler/src/test/queries/positive/hbase_pushdown.q
+++ b/hbase-handler/src/test/queries/positive/hbase_pushdown.q
@@ -1,8 +1,9 @@
 --! qt:dataset:src
 --! qt:dataset:part
-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/3b88d6c1/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 a4ea0c5..9ddecd5 100644
--- a/hbase-handler/src/test/queries/positive/hbase_queries.q
+++ b/hbase-handler/src/test/queries/positive/hbase_queries.q
@@ -1,9 +1,9 @@
 --! qt:dataset:src
 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;
 
@@ -53,9 +53,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);
@@ -65,11 +66,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
@@ -93,11 +95,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;
@@ -113,22 +116,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;
@@ -138,11 +143,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;
@@ -166,9 +172,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;
@@ -178,9 +185,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;
@@ -191,16 +199,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/3b88d6c1/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 522960c..d91a036 100644
--- a/hbase-handler/src/test/queries/positive/hbase_scan_params.q
+++ b/hbase-handler/src/test/queries/positive/hbase_scan_params.q
@@ -1,8 +1,9 @@
 --! qt:dataset:src
-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/3b88d6c1/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 bd4672b..15bf118 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,9 +1,10 @@
 --! qt:dataset:src
 -- 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/3b88d6c1/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 46d7529..5972f49 100644
--- a/hbase-handler/src/test/queries/positive/hbase_timestamp.q
+++ b/hbase-handler/src/test/queries/positive/hbase_timestamp.q
@@ -1,23 +1,26 @@
 --! qt:dataset:src
 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
@@ -42,9 +45,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/3b88d6c1/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 75820e1..eb872f4 100644
--- a/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q
+++ b/hbase-handler/src/test/queries/positive/hbase_timestamp_format.q
@@ -1,9 +1,9 @@
 --! qt:dataset:src
 
-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/3b88d6c1/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/3b88d6c1/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 0185002..6398417 100644
--- a/hbase-handler/src/test/queries/positive/hbasestats.q
+++ b/hbase-handler/src/test/queries/positive/hbasestats.q
@@ -1,11 +1,12 @@
 --! qt:dataset:src
 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/3b88d6c1/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 8b70c04..b47f467 100644
--- a/hbase-handler/src/test/queries/positive/ppd_key_ranges.q
+++ b/hbase-handler/src/test/queries/positive/ppd_key_ranges.q
@@ -1,7 +1,8 @@
 --! qt:dataset:src
-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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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/3b88d6c1/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 60721cb..012e6f3 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/3b88d6c1/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 31baba3..296353c 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
@@ -111,9 +111,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 ####
@@ -158,9 +160,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