Home  >  Article  >  Database  >  Hive外连HBase表

Hive外连HBase表

WBOY
WBOYOriginal
2016-06-07 17:26:58817browse

Hive外连HBase表 CREATE [EXTERNAL] TABLE [IF NOT EXISTS] table_name[(col_name data_type [COMMENT col_comment], ...)][COMM

Hive外连HBase表

CREATE [EXTERNAL] TABLE [IF NOT EXISTS] table_name
[(col_name data_type [COMMENT col_comment], ...)]
[COMMENT table_comment]
[PARTITIONED BY (col_name data_type
[COMMENT col_comment], ...)]
[CLUSTERED BY (col_name, col_name, ...)
[SORTED BY (col_name [ASC|DESC], ...)]
INTO num_buckets BUCKETS]
[ROW FORMAT row_format]
[STORED AS file_format]
[LOCATION hdfs_path]

连接HBase中已存在的表

CREATE EXTERNAL TABLE table_name(id int, value string)

STORED BY 'org.apache.Hadoop.hive.hbase.HBaseStorageHandler'

WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val")

TBLPROPERTIES ("hbase.table.name" = "xyz");

红色地方根据实际情况修改,绿色地方对应HBase表,,其中cf1代表列簇名,val代表列名,:key代表HBase的row赋予第一个字段,即上面例子中的红色标注的id。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn