HBASE-2470 Add Scan.setTimeRange() support in Shell

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1096523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-25 17:09:05 +00:00
parent 764a305cac
commit b91fb30a82
3 changed files with 11 additions and 0 deletions

View File

@ -183,6 +183,7 @@ Release 0.91.0 - Unreleased
HBASE-3609 Improve the selection of regions to balance; part 2 (Ted Yu)
HBASE-2939 Allow Client-Side Connection Pooling (Karthik Sankarachary)
HBASE-3798 [REST] Allow representation to elide row key and column key
HBASE-2470 Add Scan.setTimeRange() support in Shell (Harsh J Chouraria)
TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -221,6 +221,7 @@ module Hbase
columns = args["COLUMNS"] || args["COLUMN"] || get_all_columns
cache = args["CACHE_BLOCKS"] || true
versions = args["VERSIONS"] || 1
timerange = args[TIMERANGE]
# Normalize column names
columns = [columns] if columns.class == String
@ -239,6 +240,7 @@ module Hbase
scan.setTimeStamp(timestamp) if timestamp
scan.setCacheBlocks(cache)
scan.setMaxVersions(versions) if versions > 1
scan.setTimeRange(timerange[0], timerange[1]) if timerange
else
scan = org.apache.hadoop.hbase.client.Scan.new
end

View File

@ -369,6 +369,14 @@ module Hbase
assert_not_nil(res['2']['x:b'])
end
define_test "scan should support TIMERANGE parameter" do
res = @test_table.scan TIMERANGE => [0, 1]
assert_not_nil(res)
assert_kind_of(Hash, res)
assert_nil(res['1'])
assert_nil(res['2'])
end
define_test "scan should support COLUMNS parameter with an array of columns" do
res = @test_table.scan COLUMNS => [ 'x:a', 'x:b' ]
assert_not_nil(res)