hbql - apache software foundationpeople.apache.org/~jdcryans/hug8/hug8-ambrose.pdf · hbql a simple...

16
HBql A simple data access layer for HBase Thursday, January 28, 2010

Upload: vuongdan

Post on 14-Apr-2018

214 views

Category:

Documents


2 download

TRANSCRIPT

HBqlA simple data access layer for HBase

Thursday, January 28, 2010

What is HBql?

• SQL-like Grammar

• Console

• JDBC Driver

• HBql API

Thursday, January 28, 2010

DDL Statements

• CREATE/ALTER/DROP/DESCRIBE TABLE

• CREATE/DROP/DESCRIBE INDEX

• CREATE/DROP/DESCRIBE MAPPINGS

• Predicate support for DDL

Thursday, January 28, 2010

DDL Examples

• create table tableA (f1(), f2(), f3())

• create table tableB (f1(), f2(), f3()) if not tableExists('tableB')

• create table tableC (f1(MAX_VERSIONS: 10, BLOCK_SIZE:1024*48))

• create index indexA on mappingA (f1:col1)

• create index indexB on mappingB (f1:col1) include (f1:col2, f:col3)

Thursday, January 28, 2010

Mappings

• Type info, scalar or vector

• Alias, default value

• Unmapped information

• Transient or persistent

• Multiple mappings per HTable

Thursday, January 28, 2010

Mapping Example• create temp mapping mappingA for table tableA (

keyval key, familyA include unmapped ( col1 string alias val1, col2 int alias val2 ), familyB ( col3 date alias val3, col4 int[] alias val4 ))

Thursday, January 28, 2010

DML Examples

• INSERT

• DELETE

Thursday, January 28, 2010

Insert Statement

• insert into foo (keyval, val1, val2)values (zeropad(2, 10), 123, ‘test val’)

• insert into foo (keyval, f1:val3, f1:val4)values (:a, :b, DEFAULT)

• insert into foo (keyval, f1(val3, val4))select keyval, val3, val4+‘newval’ from foo2

Thursday, January 28, 2010

Delete Statement

• delete f1:* from mappingA with server filter where val1> 3 AND val2 < 9

• delete f1:val1, val2 from mappingBwith server filter where val2 LIKE ‘foo.*bar’

• delete from mappingC with server filter where val1 IN (8, 11*3)

Thursday, January 28, 2010

Select Items

• Single table (via mapping)

• Qualified names and aliases

• Mapping and family wildcards

• Expressions (arithmetic, functions, IF, CASE)

• Aggregates

Thursday, January 28, 2010

WITH Clause

• Keys and Key Ranges

• Server and client filters

• Expressions (IN, BETWEEN, LIKE, CONTAINS)

• Versions, Limit, Timestamp, Scanner_Cache_Size

Thursday, January 28, 2010

Query Example

• select keyval, f1:val1, val2, 3+val2 as val4from mappingAwith keys FIRST to :‘ddd’, ‘eee’, ‘fff ’, ‘ggg’ to ‘ooo’server filter where val6 > 9client filter where val5 < 2versions 4limit 100

Thursday, January 28, 2010

JDBC Driver

• Connection pooling

• PreparedStatement parameters

• Cast to get to the HBql calls

• Uses HTablePool

• Uses Mappings

Thursday, January 28, 2010

HBql API

• Parallel to JDBC

• HRecord or simple object mapping

• Connection pooling

• Concurrent result set processing with Query Executor Pools

• Asynchronous queries with Async Executor Pools

• QueryListeners

Thursday, January 28, 2010

Futures

• Better docs

• Spring JDBCTemplate support

• Coprocessors integration

• Java UDFs in expressions

• Console web interface

• Feedback from users

Thursday, January 28, 2010