Skip to content

Commit

Permalink
add demo2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacky Li committed Jul 20, 2015
1 parent b917253 commit 20ee45c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/spark-hbase-demo2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## create spark sql table map to existing hbase (only single column mapping to hbase rowkey is supported)
(1) create table in hbase
```
create 'hbase10k', 'f'
for i in '1'..'10000' do for j in '1'..'2' do put 'hbase10k', "row#{i}", "f:c#{j}", "#{i}#{j}" end end
```

(2) relate 'test' from SparkOnHbase
```
CREATE TABLE spark10k(rowkey STRING, a INTEGER, b INTEGER, PRIMARY KEY (rowkey)) MAPPED BY (hbase10k, COLS=[a=f.c1, b=f.c2]);
```

(3) Query :
```
// test count *
(1) select count(*) from spark10k
// test group by
(2) select avg(a), b from spark10k group by b
```

0 comments on commit 20ee45c

Please sign in to comment.