赞
踩
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
建好表之后,进入hbase shell执行list能看到表s01_buyer_calllogs_info_ts,hive drop掉此表时,hbase也被drop。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
从方式需要先在hbase建好表,然后在hive中建表,hive drop掉表,hbase表不会变。
- CREATE EXTERNAL TABLE hiveFromHbase(
- rowkey string,
- f1 map<STRING,STRING>,
- f2 map<STRING,STRING>,
- f3 map<STRING,STRING>
- ) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
- WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,f1:,f2:,f3:")
- TBLPROPERTIES ("hbase.table.name" = "hbase_test");
- hive> select * from hiveFromHbase;
- OK
- r1 {"name":"zhangsan"} {"age":"20"} {"sex":"male"}
- r2 {"name":"lisi"} {"age":"30"} {"sex":"female"}
- r3 {"name":"wangwu"} {"age":"40"} {"sex":"male"}
- Time taken: 0.158 seconds, Fetched: 3 row(s)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。