hbase中的表结构:
表:data_detail_history 列族:data 列:jssl-tgy_0000_00_07.........
在hive中写sql
注意:EXTERNAL表示HBase中已经存在了data_detail_history表;
映射字段最多只能有175个字段 ,超过175个字段,查询该表会报错
CREATE EXTERNAL TABLE hbase_jssl_tgy_history(
key string,
code1 string,
code2 string,
version string,
framCycle string
)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" =
":key,
data:jssl-tgy_0000_00_07,
data:jssl-tgy_0001_00_07,
data:jssl-tgy_0002_00_15,
data:jssl-tgy_0004_00_15,
data:jssl-tgy_0006_00_07")
TBLPROPERTIES ("hbase.table.name" = "data_detail_history","hbase.mapred.output.outputtable" = "data_detail_history");
hbase中有数据? 就会到hive中 hbase数据删除,hive中的数据也删除了!
参考:https://www.cnblogs.com/lojun/p/9703973.html
|