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:
parent
5981dc4511
commit
fdbe8da2c6
|
@ -48,6 +48,7 @@ module HBaseConstants
|
||||||
METHOD = "METHOD"
|
METHOD = "METHOD"
|
||||||
MAXLENGTH = "MAXLENGTH"
|
MAXLENGTH = "MAXLENGTH"
|
||||||
CACHE_BLOCKS = "CACHE_BLOCKS"
|
CACHE_BLOCKS = "CACHE_BLOCKS"
|
||||||
|
REVERSED = "REVERSED"
|
||||||
REPLICATION_SCOPE = "REPLICATION_SCOPE"
|
REPLICATION_SCOPE = "REPLICATION_SCOPE"
|
||||||
INTERVAL = 'INTERVAL'
|
INTERVAL = 'INTERVAL'
|
||||||
CACHE = 'CACHE'
|
CACHE = 'CACHE'
|
||||||
|
|
|
@ -346,6 +346,7 @@ EOF
|
||||||
columns = args["COLUMNS"] || args["COLUMN"] || []
|
columns = args["COLUMNS"] || args["COLUMN"] || []
|
||||||
cache_blocks = args["CACHE_BLOCKS"] || true
|
cache_blocks = args["CACHE_BLOCKS"] || true
|
||||||
cache = args["CACHE"] || 0
|
cache = args["CACHE"] || 0
|
||||||
|
reversed = args["REVERSED"] || false
|
||||||
versions = args["VERSIONS"] || 1
|
versions = args["VERSIONS"] || 1
|
||||||
timerange = args[TIMERANGE]
|
timerange = args[TIMERANGE]
|
||||||
raw = args["RAW"] || false
|
raw = args["RAW"] || false
|
||||||
|
@ -380,6 +381,7 @@ EOF
|
||||||
|
|
||||||
scan.setTimeStamp(timestamp) if timestamp
|
scan.setTimeStamp(timestamp) if timestamp
|
||||||
scan.setCacheBlocks(cache_blocks)
|
scan.setCacheBlocks(cache_blocks)
|
||||||
|
scan.setReversed(reversed)
|
||||||
scan.setCaching(cache) if cache > 0
|
scan.setCaching(cache) if cache > 0
|
||||||
scan.setMaxVersions(versions) if versions > 1
|
scan.setMaxVersions(versions) if versions > 1
|
||||||
scan.setTimeRange(timerange[0], timerange[1]) if timerange
|
scan.setTimeRange(timerange[0], timerange[1]) if timerange
|
||||||
|
|
|
@ -42,6 +42,7 @@ Some examples:
|
||||||
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
|
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
|
||||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
|
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
|
||||||
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
|
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
|
||||||
|
hbase> scan 't1', {REVERSED => true}
|
||||||
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
|
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
|
||||||
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
|
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
|
||||||
hbase> scan 't1', {FILTER =>
|
hbase> scan 't1', {FILTER =>
|
||||||
|
|
|
@ -424,6 +424,18 @@ module Hbase
|
||||||
assert_not_nil(res['1']['x:b'])
|
assert_not_nil(res['1']['x:b'])
|
||||||
assert_nil(res['2'])
|
assert_nil(res['2'])
|
||||||
end
|
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
|
define_test "scan should support TIMESTAMP parameter" do
|
||||||
res = @test_table._scan_internal TIMESTAMP => @test_ts
|
res = @test_table._scan_internal TIMESTAMP => @test_ts
|
||||||
|
|
Loading…
Reference in New Issue