1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-- 切换 DB
use t_hbase_db;
-- 创建测试表
create table test_hive_user_info(
user_id string comment '用户id',
user_name string comment '用户名',
user_gender string comment '性别',
user_age int comment '年龄',
province string comment '省份',
city string comment '城市'
)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,
base_info:user_name,
base_info:gender,
base_info:age,
extra_info:province,
extra_info:city")
TBLPROPERTIES ("hbase.table.name" = "t_hbase_db:test_hive_user_info",
"hbase.mapred.output.outputtable" = "t_hbase_db:test_hive_user_info");
|