hive on hbase中列族的列名不固定

问题:列族中列名的数量不固定,随时变化

问题分析:

这种情况,在hive中提前做好映射是不可能的;

解决:可以用hive中的map映射


案例:

hbase中建表:

create 'user_profile','cf'


hive建表:

CREATE EXTERNAL TABLE  user_profile ( username STRING, labels map<string, string> )
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:#s:b")
TBLPROPERTIES("hbase.table.name" = "user_profile");

猜你喜欢

转载自www.cnblogs.com/weiyiming007/p/12198018.html