diff --git a/hbase-shell/src/main/ruby/hbase.rb b/hbase-shell/src/main/ruby/hbase.rb index 940906a1a13..fd053bc30db 100644 --- a/hbase-shell/src/main/ruby/hbase.rb +++ b/hbase-shell/src/main/ruby/hbase.rb @@ -48,6 +48,7 @@ module HBaseConstants METHOD = "METHOD" MAXLENGTH = "MAXLENGTH" CACHE_BLOCKS = "CACHE_BLOCKS" + REVERSED = "REVERSED" REPLICATION_SCOPE = "REPLICATION_SCOPE" INTERVAL = 'INTERVAL' CACHE = 'CACHE' diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb index c78700b1455..3685ecafd0e 100644 --- a/hbase-shell/src/main/ruby/hbase/table.rb +++ b/hbase-shell/src/main/ruby/hbase/table.rb @@ -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 diff --git a/hbase-shell/src/main/ruby/shell/commands/scan.rb b/hbase-shell/src/main/ruby/shell/commands/scan.rb index 0564ad819d8..129961f2976 100644 --- a/hbase-shell/src/main/ruby/shell/commands/scan.rb +++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb @@ -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 => diff --git a/hbase-shell/src/test/ruby/hbase/table_test.rb b/hbase-shell/src/test/ruby/hbase/table_test.rb index f55e941ef13..0f6347642e5 100644 --- a/hbase-shell/src/test/ruby/hbase/table_test.rb +++ b/hbase-shell/src/test/ruby/hbase/table_test.rb @@ -424,6 +424,18 @@ module Hbase assert_not_nil(res['1']['x:b']) 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