Hive建表映射到Hbase

Hive内部表,语句如下

create table hbase_video(
    videoId string,
    uploader string,
    age int,
    category array,
    length int,
    views int,
    rate float,
    ratings int,
    comments int,
    relatedId array)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties("hbase.columns.mapping" = "cf:uploader,cf:age,cf:category,cf:length,cf:views,cf:rate,cf:ratings,cf:comments,cf:relatedId")
tblproperties("hbase.table.name" = "hbase_video");

Hive外部表,语句如下(从方式需要先在hbase建好表,然后在hive中建表,hive drop掉表,hbase表不会变)

create external table hbase_video(
    videoId string,
    uploader string,
    age int,
    category array,
    length int,
    views int,
    rate float,
    ratings int,
    comments int,
    relatedId array)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties("hbase.columns.mapping" = "cf:uploader,cf:age,cf:category,cf:length,cf:views,cf:rate,cf:ratings,cf:comments,cf:relatedId")
tblproperties("hbase.table.name" = "hbase_video");
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注