hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Rawson <ryano...@gmail.com>
Subject Re: VERSIONS in Shell
Date Tue, 18 Jan 2011 09:30:00 GMT
the parse code inside table.rb is wacky, maybe this fixes it:

diff --git a/src/main/ruby/hbase/table.rb b/src/main/ruby/hbase/table.rb
index c8e0076..cd90132 100644
--- a/src/main/ruby/hbase/table.rb
+++ b/src/main/ruby/hbase/table.rb
@@ -138,19 +138,17 @@ module Hbase
               get.addFamily(family)
             end
           end
-
-          # Additional params
-          get.setMaxVersions(args[VERSIONS] || 1)
-          get.setTimeStamp(args[TIMESTAMP]) if args[TIMESTAMP]
         else
           # May have passed TIMESTAMP and row only; wants all columns from ts.
-          unless ts = args[TIMESTAMP]
-            raise ArgumentError, "Failed parse of #{args.inspect},
#{args.class}"
+          if ts = args[TIMESTAMP]
+            # Set the timestamp
+           get.setTimeStamp(ts.to_i)
           end
-
-          # Set the timestamp
-          get.setTimeStamp(ts.to_i)
         end
+
+        # Additional params
+        get.setMaxVersions(args[VERSIONS] || 1)
+        get.setTimeStamp(args[TIMESTAMP]) if args[TIMESTAMP]
       end

       # Call hbase for the results


On Tue, Jan 18, 2011 at 12:36 AM, Lars George <lars.george@gmail.com> wrote:
> Hi,
>
> On hbase-0.89.20100924+28 I tried to get all versions for a cell that
> has 3 versions and on the shell I got:
>
> hbase(main):014:0> get 'hbase_table_1', '498', {VERSIONS=>10}
> COLUMN                                        CELL
>
> ERROR: Failed parse of {"VERSIONS"=>10}, Hash
>
> Here is some help for this command:
>          Get row or cell contents; pass table name, row, and optionally
>          a dictionary of column(s), timestamp and versions. Examples:
>
>            hbase> get 't1', 'r1'
>            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', TIMESTAMP => ts1,
> VERSIONS => 4}
>            hbase> get 't1', 'r1', 'c1'
>            hbase> get 't1', 'r1', 'c1', 'c2'
>            hbase> get 't1', 'r1', ['c1', 'c2']
>
>
> hbase(main):015:0> scan 'hbase_table_1', { STARTROW=>'498',
> STOPROW=>'498',VERSIONS=>10}
> ROW                                           COLUMN+CELL
>  498                                          column=cf1:val,
> timestamp=1295335912913, value=val_498
>  498                                          column=cf1:val,
> timestamp=1295335912913, value=val_498
>  498                                          column=cf1:val,
> timestamp=1295335912913, value=val_498
> 1 row(s) in 0.0520 seconds
>
> hbase(main):016:0>
>
> So the scan works but not the get. That's wrong, right?
>
> Lars
>

Mime
View raw message