hive對映hbase,通過phoenix查詢該錶

2021-09-24 05:26:53 字數 1122 閱讀 2087

rowkey:key(生成規則待定)

列族(單列族):cf1

列名: id,name,code

1在hive中建表對映到hbase

create table tmp.test_hbase_phoenix(key string,id int,name string,code string)

stored by 'org.apache.hadoop.hive.hbase.hbasestoragehandler'

tblproperties ("hbase.table.name" = "test_hbase_phoenix", "hbase.mapred.output.outputtable" = "test_hbase_phoenix");

注意:

1第乙個欄位為key,如果換成id本人測試會出問題

2構建為內部表,外部表報錯

2在phoenix中建立hbase的表

create table if not exists "test_hbase_phoenix"("key" varchar primary key ,

"cf1"."id" varchar,

"cf1"."name" varchar ,

"cf1"."code" varchar);

3通過phoenix插入資料

upsert into test_hbase_phoenix values('1','1','張三','zs');

upsert into test_hbase_phoenix values('2','2','李四','ls');

upsert into test_hbase_phoenix values('3','3','王五','ww');

在phoenix查詢該錶

在hive中查詢該錶,查詢不到該錶資料

和hbase對映 hbase整合hive

hive提供了與hbase的整合,是的能夠在hbase表上使用hive sql語句進行查詢 插入操作以及進行join和union等複雜查詢 同時也可以將hive表中的資料對映到hbase中。當我們在使用hive時候,在資料量多的時候就會發現非常的慢,乙個簡單的sql都要半天,其實我們追尋他的原因很簡...

hive對映hbase表資料

一般來說,hive對映表資料都是對映hdfs上的資料,直接通過location指定對映目錄,然後可以查詢資料。但是hive對映hbase表資料,是直接對映hbase中的表。create events db user friend uf 注釋 set hive.exec dynamic.partiti...

Hbase對映hive表的方式

使用hsql建立乙個指向hbase表的hive表 兩種建立表方式分別如下 區別,主要看資料在hbase下還是在hive下。1 如果hbase表已經存在,可以建立外部表,如下 create external table hive table name key string,col name1 stri...