Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Last active December 1, 2015 22:16
Show Gist options
  • Save gbraccialli/53e051101bf37b65ea6f to your computer and use it in GitHub Desktop.
Save gbraccialli/53e051101bf37b65ea6f to your computer and use it in GitHub Desktop.
phoenix
jdbc:
jar:
/usr/hdp/2.2.0.0-2041/phoenix/phoenix-4.2.0.2.2.0.0-2041-client.jar
driver:
org.apache.phoenix.jdbc.PhoenixDriver
connection string:
jdbc:phoenix:sandbox.hortonworks.com:2181:/hbase-unsecure
command line:
/usr/hdp/current/phoenix-client/bin/sqlline.py localhost:2181:/hbase-unsecure
sample table:
CREATE TABLE TABLE1 (ID BIGINT NOT NULL PRIMARY KEY, COL1 VARCHAR);
UPSERT INTO TABLE1 (ID, COL1) VALUES (1, 'test_row_1');
UPSERT INTO TABLE1 (ID, COL1) VALUES (2, 'test_row_2');
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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment