際際滷

際際滷Share a Scribd company logo
HAWQ
Introduction
Agenda
Key Ideas
Architecture
Use cases
Demo
Key Ideas
In-memory
Distributed
SQL
Transaction support
Runs as Hadoop Service
Two way integration with - HDFS, Hive, HBase
Architecture
Use cases
Transactions
Integration - HDFS, Hive, HBase
Transaction
[gpadmin@edge ~]$ gpsql
psql (8.2.15)
Type "help" for help.
template1=# create table transaction_test(col1 varchar(50));
CREATE TABLE
template1=# begin transaction;
BEGIN
template1=# insert into transaction_test values('123');
INSERT 0 1
template1=# commit;
COMMIT
template1=# select * from transaction_test;
col1
------
123
(1 row)
template1=# begin transaction;
BEGIN
template1=# insert into transaction_test values('456');
INSERT 0 1
template1=# rollback;
ROLLBACK
template1=# select * from transaction_test;
col1
------
123
(1 row)
Transaction
template1=# begin transaction;
BEGIN
template1=# delete from transaction_test;
ERROR: Delete append-only table statement not supported yet
template1=# select * from transaction_test;
ERROR: current transaction is aborted, commands ignored until end of transaction block
template1=# end
template1-# ;
ROLLBACK
template1=#
template1=# begin transaction;
BEGIN
template1=# update transaction_test set col1 = '456';
ERROR: Update append-only table statement not supported yet
template1=# end;
ROLLBACK
template1=#
Integration - HDFS, Hive, HBase
CREATE external table retail_demo.customers_dim_hawq
(
customer_id TEXT,
first_name TEXT,
last_name TEXT,
gender TEXT
)
LOCATION ('pxf://namenode:51200/retail_demo/customers_dim.tsv.gz?profile=HdfsTextSimple') FORMAT 'TEXT' (DELIMITER = E't');
CREATE external table retail_demo.customers_dim_hawq
(
customer_id bigint,
first_name TEXT,
last_name TEXT,
gender TEXT
)
LOCATION ('pxf://namenode:51200/retail_demo.customers_dim_hive?profile=Hive') FORMAT 'custom' (formatter='pxfwritable_import');
CREATE external table retail_demo.customers_dim_hawq
(
customer_id bigint,
first_name TEXT,
last_name TEXT,
gender TEXT
)
LOCATION ('pxf://namenode:51200/customers_dim_hawq?profile=Hbase') FORMAT 'custom' (formatter='pxfwritable_import');

More Related Content

Apache HAWQ : An Introduction

  • 3. Key Ideas In-memory Distributed SQL Transaction support Runs as Hadoop Service Two way integration with - HDFS, Hive, HBase
  • 6. Transaction [gpadmin@edge ~]$ gpsql psql (8.2.15) Type "help" for help. template1=# create table transaction_test(col1 varchar(50)); CREATE TABLE template1=# begin transaction; BEGIN template1=# insert into transaction_test values('123'); INSERT 0 1 template1=# commit; COMMIT template1=# select * from transaction_test; col1 ------ 123 (1 row) template1=# begin transaction; BEGIN template1=# insert into transaction_test values('456'); INSERT 0 1 template1=# rollback; ROLLBACK template1=# select * from transaction_test; col1 ------ 123 (1 row)
  • 7. Transaction template1=# begin transaction; BEGIN template1=# delete from transaction_test; ERROR: Delete append-only table statement not supported yet template1=# select * from transaction_test; ERROR: current transaction is aborted, commands ignored until end of transaction block template1=# end template1-# ; ROLLBACK template1=# template1=# begin transaction; BEGIN template1=# update transaction_test set col1 = '456'; ERROR: Update append-only table statement not supported yet template1=# end; ROLLBACK template1=#
  • 8. Integration - HDFS, Hive, HBase CREATE external table retail_demo.customers_dim_hawq ( customer_id TEXT, first_name TEXT, last_name TEXT, gender TEXT ) LOCATION ('pxf://namenode:51200/retail_demo/customers_dim.tsv.gz?profile=HdfsTextSimple') FORMAT 'TEXT' (DELIMITER = E't'); CREATE external table retail_demo.customers_dim_hawq ( customer_id bigint, first_name TEXT, last_name TEXT, gender TEXT ) LOCATION ('pxf://namenode:51200/retail_demo.customers_dim_hive?profile=Hive') FORMAT 'custom' (formatter='pxfwritable_import'); CREATE external table retail_demo.customers_dim_hawq ( customer_id bigint, first_name TEXT, last_name TEXT, gender TEXT ) LOCATION ('pxf://namenode:51200/customers_dim_hawq?profile=Hbase') FORMAT 'custom' (formatter='pxfwritable_import');