hbase_scan()

Description:

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

Syntax:

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

Note:

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

Options:

@c

Return a cursor

Parameters:

client

Database connection information

tableName

Table name

rowName

Row 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

timeStamp:t

Timestamp

Return value:

A table sequence/cursor

Example:

 

A

 

1

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

 

 

 

 

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 functions:

hbase_open()

hbase_cmp()