hbase_scan()

阅读(2984) 标签: 查询, hbase数据库, 游标, 序表,

描述:

查询hbase数据库中的数据,结果值返回游标或者序表。

语法:

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

备注:

外部库函数,外部库的使用请参考《外部库使用指南》。

通过habse_scan函数获取hbase数据库中的数据,默认返回序表,使用@c选项时返回游标。

选项:

@c

返回游标。

参数:

client

数据库连接信息。

tableName

表名。

family

列族名。

column

列名。

Type

类型,可省略。

alias

列别名,可省略。

rowPrefix:x

rowPrefix:”为固定写法,参数xrowKey前缀。

filter:f

filter句柄。

startRow:startrow

startRow:”是固定写法,参数startrow为起始行,截取的数据包含改行。

stopRow:stoprow

stopRow:”是固定写法,参数stoprow为结束行,截取的数据不包含改行。

timeRange:[t1,t2]

timeRange:[,]”是固定写法,t1为起始时间戳,取出的数据包含t1value值,t2为结束时间戳,取出的数据不包含t1value值。

返回值:

序表/游标

示例:

 

A

 

1

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

 

 

 

 

2

 

 

 

=hbase_scan(A1,"emp")

查询表中所有数据。

 

3

 

=hbase_scan@c(A1,"emp")

返回游标。

 

 

 

4

 

 

 

=A3.fetch()

5

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

 

 

6

 

 

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

返回A5单元格过滤出的数据。

 

 

7

 

 

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,

"family:tel":string;filter:A5,startRow:row3,stopRow:row7)

A5单元格中过滤的数据中取row3row7行的数据,不包含row7行。

 

8

 

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,

"family:tel":string;filter:A5,rowPrefix:row1)

 

A5单元格中过滤的数据中取出rowKey前缀为row1的行。

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])

 

相关概念:

hbase_open()

hbase_cmp()