hbase_scan()

Description:

Query a HBase database and return result as a cursor or a table sequence.

Syntax:

hbase_scan(client,tableName,family:column:type:alias,family2:column2:type:alias2,...;rowPrefix:x,filter:f,startRow:startrow,stopRow:stoprow,timeRange:[t1,t2]) .

Note:

This external library function (See External Library Guide) gets data from an HBase database and by default returns a table sequence. Return a cursor when there’s @c option.

Option:

@c

Return a cursor

Parameter:

client

Database connection information.

tableName

Table name.

family

Column family name.

column

Column name.

Type

Data type; can be omitted.

alias

Another name of a column; can be omitted.

rowPrefix:x

“rowPrefix:” is a fixed format; parameter x is the prefix of rowKey .

filter:f

Filter handle.

startRow:startrow

“startRow:” is a fixed format; parameter startrow represents the starting row, which will be included in data retrieval.

stopRow:stoprow

“stopRow:” is a fixed format; parameter stoprow represents the ending row, which will be excluded in data retrieval.

timeRange:[t1,t2]

“timeRange:[,]” is a fixed format; parameter t1 is the starting timestamp whose value will be retrieved, and parameter t2 is the ending timestamp whose value won’t be retrieved.

Return value:

Table sequence/Cursor

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8:9000")

 

 

 

 

2

 

 

 

=hbase_scan(A1,"emp")

Query all table data.

3

 

=hbase_scan@c(A1,"emp")

Return a cursor.

 

 

 

4

 

 

 

=A3.fetch()

5

=hbase_filter("SingleColumnValueFilter","family","tel","=",hbase_cmp@s("13"))

 

 

 

6

 

 

=hbase_scan(A1,"emp";filter:A5)

Return data filtered out by A5.

 

 

7

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3,stopRow:row7)

Get data from row3 to row7, which is excluded, from A5’s filtered data.

8

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,rowPrefix:row1)

 

Get a row whose prefix is row1 from A5’s filtered data.

9

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3

,stopRow:row7,timeStamp:1488855958071)

 

10

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3,

stopRow:row7,timeRange:[1488855958071,1488855958255])

 

Related function:

hbase_open()

hbase_cmp()