hive和hbase的联合表

在hive中创建表: 主键,账户状态,余额,同时定义好其在hbase中的mapping表名,以及键值对。 注意:hive表中必须有字段key作为主键

 

CREATE TABLE grzx_common(key string, account_status string, balance string)    

STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  

WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:account_status,info:balance")   

TBLPROPERTIES ("hbase.table.name" = "grzx_common");

 

hive中查看表desc grzx_common;

hbase中查看表describe "grzx_common"

 

hive中insert数据insert into table grzx_common select 'F1234','2','50000' from dual;

hbase中查看结果: get 'grzx_common','F1234'

 

 

hbase中修改数据:put 'grzx_common','F1234','info:balance','60000'

hive中查看结果: select * from grzx_common

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值