rowkey:key(生成规则待定)
列族(单列族):cf1
列名: id,name,code
1在hive中建表映射到hbase
CREATE TABLE tmp.test_hbase_phoenix(key string,id int,name string,code string)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:id,cf1:name,cf1:code")
TBLPROPERTIES ("hbase.table.name" = "test_hbase_phoenix", "hbase.mapred.output.outputtable" = "test_hbase_phoenix");
注意:
1第一个字段为key,如果换成id本人测试会出问题
2构建为内部表,外部表报错
2在Phoenix中创建hbase的表
create table if not exists "TEST_HBASE_PHOENIX"("key" varchar primary key ,
"cf1"."id" varchar,
"cf1"."name" varchar ,
"cf1"."code" varchar);
3通过Phoenix插入数据
upsert into TEST_HBASE_PHOENIX values('1','1','张三','zs');
upsert into TEST_HBASE_PHOENIX values('2','2','李四','ls');
upsert into TEST_HBASE_PHOENIX values('3','3','王五','ww');
在phoenix查询该表
在hive中查询该表,查询不到该表数据