[Author]: kwu
创建hive整合hbase的表总结,如下两种方式:
1、创建hive表的同步创建hbase的表
CREATE TABLE stage.hbase_news_company_content(key string comment "流水号",
news_id string comment "新闻id",
news_content string comment "文章内容")
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:news_id,cf1:news_content")
TBLPROPERTIES("hbase.table.name" = "news_company_content");
2、外表创建hive表整合hbase的表
需要先创建hbase的表:
create 'jsActionPage','cf1'
CREATE EXTERNAL TABLE ods.hbase_jsActionPage(key string, bdcCookieId string ,
pcScreenRatio string ,
pageCloseTime string ,
pageLoadCompleteTime string,
pageOpenTime string,
currentURL string)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:bdcCookieId,cf1:pcScreenRatio,
cf1:pageCloseTime,
cf1:pageLoadCompleteTime,
cf1:pageOpenTime,
cf1:currentURL")
TBLPROPERTIES("hbase.table.name" = "jsActionPage");
SQL方式:
insert into stage.hbase_news_company_content select a,b,c from stage.tracklog limit 15;
put 'jsActionPage','row1','cf1:time','20150818'
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/bdchome/article/details/47805283