create external table if not exists [external-table-name] (
[column1-name] [column1-type], [column2-name] [column2-type], …)
comment '[comment]'
row format [format-type]
fields terminated by '[termination-character]'
stored as [storage-type]
location '[location]';
CREATE EXTERNAL TABLE <hive_table_name>(key string,
col1 string, col2 string, col3 string
)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" =
":key,
cf:col1,
cf:col2,
cf:col3
")
TBLPROPERTIES("hbase.table.name" = "<hbase_table_name>", "hbase.mapred.output" = "<hbase_table_name>");