Index: src/main/ruby/hbase.rb =================================================================== --- src/main/ruby/hbase.rb (revision 1088470) +++ src/main/ruby/hbase.rb (working copy) @@ -36,6 +36,7 @@ COLUMN = "COLUMN" COLUMNS = "COLUMNS" TIMESTAMP = "TIMESTAMP" + TIMERANGE = "TIMERANGE" NAME = org.apache.hadoop.hbase.HConstants::NAME VERSIONS = org.apache.hadoop.hbase.HConstants::VERSIONS IN_MEMORY = org.apache.hadoop.hbase.HConstants::IN_MEMORY Index: src/main/ruby/shell/commands/get.rb =================================================================== --- src/main/ruby/shell/commands/get.rb (revision 1088818) +++ src/main/ruby/shell/commands/get.rb (working copy) @@ -27,9 +27,11 @@ a dictionary of column(s), timestamp and versions. Examples: hbase> get 't1', 'r1' + hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]} hbase> get 't1', 'r1', {COLUMN => 'c1'} hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} + hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} hbase> get 't1', 'r1', 'c1' hbase> get 't1', 'r1', 'c1', 'c2' Index: src/main/ruby/hbase/table.rb =================================================================== --- src/main/ruby/hbase/table.rb (revision 1089292) +++ src/main/ruby/hbase/table.rb (working copy) @@ -120,6 +120,13 @@ unless args.empty? columns = args[COLUMN] || args[COLUMNS] + if args[VERSIONS] + vers = args[VERSIONS] + elsif args[TIMERANGE] + vers = 3 + else + vers = 1 + end if columns # Normalize types, convert string to an array of strings columns = [ columns ] if columns.is_a?(String) @@ -140,16 +147,19 @@ end # Additional params - get.setMaxVersions(args[VERSIONS] || 1) + get.setMaxVersions(vers) get.setTimeStamp(args[TIMESTAMP]) if args[TIMESTAMP] + get.setTimeRange(args[TIMERANGE][0], args[TIMERANGE][1]) if args[TIMERANGE] else # May have passed TIMESTAMP and row only; wants all columns from ts. - unless ts = args[TIMESTAMP] + unless ts = args[TIMESTAMP] || tr = args[TIMERANGE] raise ArgumentError, "Failed parse of #{args.inspect}, #{args.class}" end - # Set the timestamp - get.setTimeStamp(ts.to_i) + get.setMaxVersions(vers) + # Set the timestamp/timerange + get.setTimeStamp(ts.to_i) if args[TIMESTAMP] + get.setTimeRange(args[TIMERANGE][0], args[TIMERANGE][1]) if args[TIMERANGE] end end