TeRiTeRi

  1. 首页
  2. 大数据
  3. Hbase
  4. 正文

Hive建表映射到Hbase

2020年1月6日 1749点热度 1人点赞 0条评论

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");
标签: centos HBase Hive linux
最后更新:2020年1月6日

kamisamak

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2023 TeRiTeRi. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang