forked from Huawei-Spark/Spark-SQL-on-HBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jacky Li
committed
Jul 20, 2015
1 parent
b917253
commit 20ee45c
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |