create external table if not exists wedw_ods.log_status_from_hbase
(
m_id string
,order_info_id string
,before_status int
,after_status int
,status_type int
,description string
,gmt_created string
,gmt_modified string
)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties ("hbase.columns.mapping" =
":key,f:order_info_id,f:before_status,f:after_status,f:status_type,
f:description,f:gmt_created,f:gmt_modified")
tblproperties ("hbase.table.name" = "log:log_status");
注意:该Hive表一个外部表,所以删除该表并不会删除HBase表中的数据
1、建表或映射表的时候如果没有指定:key则第一个列默认就是行键
2、HBase对应的Hive表中没有时间戳概念,默认返回的就是最新版本的值
3、由于HBase中没有数据类型信息,所以在存储数据的时候都转化为String类型