HBASE-10114 _scan_internal() in table.rb should accept argument that specifies reverse scan

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1550022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
zjushch 2013-12-11 01:51:38 +00:00
parent 5981dc4511
commit fdbe8da2c6
4 changed files with 16 additions and 0 deletions

View File

@ -48,6 +48,7 @@ module HBaseConstants
METHOD = "METHOD"
MAXLENGTH = "MAXLENGTH"
CACHE_BLOCKS = "CACHE_BLOCKS"
REVERSED = "REVERSED"
REPLICATION_SCOPE = "REPLICATION_SCOPE"
INTERVAL = 'INTERVAL'
CACHE = 'CACHE'

View File

@ -346,6 +346,7 @@ EOF
columns = args["COLUMNS"] || args["COLUMN"] || []
cache_blocks = args["CACHE_BLOCKS"] || true
cache = args["CACHE"] || 0
reversed = args["REVERSED"] || false
versions = args["VERSIONS"] || 1
timerange = args[TIMERANGE]
raw = args["RAW"] || false
@ -380,6 +381,7 @@ EOF
scan.setTimeStamp(timestamp) if timestamp
scan.setCacheBlocks(cache_blocks)
scan.setReversed(reversed)
scan.setCaching(cache) if cache > 0
scan.setMaxVersions(versions) if versions > 1
scan.setTimeRange(timerange[0], timerange[1]) if timerange

View File

@ -42,6 +42,7 @@ Some examples:
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
hbase> scan 't1', {REVERSED => true}
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
hbase> scan 't1', {FILTER =>

View File

@ -425,6 +425,18 @@ module Hbase
assert_nil(res['2'])
end
define_test "scan should support REVERSED parameter" do
res = @test_table._scan_internal REVERSED => true
assert_not_nil(res)
assert_kind_of(Hash, res)
assert_not_nil(res['1'])
assert_not_nil(res['1']['x:a'])
assert_not_nil(res['1']['x:b'])
assert_not_nil(res['2'])
assert_not_nil(res['2']['x:a'])
assert_not_nil(res['2']['x:b'])
end
define_test "scan should support TIMESTAMP parameter" do
res = @test_table._scan_internal TIMESTAMP => @test_ts
assert_not_nil(res)