原文出处:
https://community.hortonworks.com/questions/1558/bestoptimized-way-to-move-data-from-phoenix-to-hiv.html
see a simple example below:
- PHOENIX:
- CREATE TABLE TEST(
- ID VARCHAR not null,
- TEXT VARCHAR
- CONSTRAINT PK PRIMARY KEY (ID)
- ) ;
- HIVE:
- CREATE EXTERNAL TABLE TEST(ID int, TEXT string)
- STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
- WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,0:TEXT")
- TBLPROPERTIES ("hbase.table.name" = "TEST");
A more complex example, with composite key and numeric data types:
- PHOENIX:
- CREATE TABLE TEST2(
- ID1 VARCHAR NOT NULL,
- ID2 VARCHAR NOT NULL,
- NUM DOUBLE,
- TEXT VARCHAR
- CONSTRAINT PK PRIMARY KEY (ID1, ID2)
- );
- HIVE:
- CREATE EXTERNAL TABLE TEST2(KEY STRUCT<ID1:STRING, ID2:STRING>, NUM DOUBLE, TEXT STRING)
- ROW FORMAT DELIMITED
- COLLECTION ITEMS TERMINATED BY '\u0000'
- STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
- WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,0:NUM,0:TEXT",
- "hbase.table.default.storage.type" = "binary")
- TBLPROPERTIES ("hbase.table.name" = "TEST2");