You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/10/09 01:45:31 UTC

svn commit: r703025 - in /hadoop/hbase/trunk: CHANGES.txt bin/HBase.rb bin/hirb.rb

Author: stack
Date: Wed Oct  8 16:45:30 2008
New Revision: 703025

URL: http://svn.apache.org/viewvc?rev=703025&view=rev
Log:
HBASE-852  Cannot scan all families in a row with a LIMIT, STARTROW, etc.

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/bin/HBase.rb
    hadoop/hbase/trunk/bin/hirb.rb

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=703025&r1=703024&r2=703025&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Oct  8 16:45:30 2008
@@ -5,6 +5,8 @@
                (Doğacan Güney via Stack)
    HBASE-905   Remove V5 migration classes from 0.19.0 (Jean-Daniel Cryans via
                Jim Kellerman)
+   HBASE-852   Cannot scan all families in a row with a LIMIT, STARTROW, etc.
+               (Izaak Rubin via Stack)
 
   BUG FIXES
    HBASE-891   HRS.validateValuesLength throws IOE, gets caught in the retries

Modified: hadoop/hbase/trunk/bin/HBase.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/HBase.rb?rev=703025&r1=703024&r2=703025&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/HBase.rb (original)
+++ hadoop/hbase/trunk/bin/HBase.rb Wed Oct  8 16:45:30 2008
@@ -223,33 +223,33 @@
        result
     end
 
-    def scan(columns, args = {})
+    def scan(args = {})
       now = Time.now 
-      if not columns or columns.length < 1
-        # Make up list of columns.
-        columns = getAllColumns()
-      end
-      if columns.class == String
-        columns = [columns]
-      elsif columns.class != Array
-        raise ArgumentError.new("Must supply columns")
-      end
-      cs = columns.to_java(java.lang.String)
       limit = -1
-      if args == nil or args.length <= 0
-        s = @table.getScanner(cs)
-      else
+      if args != nil and args.length > 0
         limit = args["LIMIT"] || -1 
         filter = args["FILTER"] || nil
         startrow = args["STARTROW"] || ""
         stoprow = args["STOPROW"] || nil
         timestamp = args["TIMESTAMP"] || HConstants::LATEST_TIMESTAMP
+        columns = args["COLUMNS"] || getAllColumns()
+        
+        if columns.class == String
+          columns = [columns]
+        elsif columns.class != Array
+          raise ArgumentError.new("COLUMNS must be specified as a String or an Array")
+        end
+        cs = columns.to_java(java.lang.String)
+        
         if stoprow
           s = @table.getScanner(cs, startrow, stoprow, timestamp)
         else
           s = @table.getScanner(cs, startrow, timestamp, filter) 
         end
-      end 
+      else
+        columns = getAllColumns()
+        s = @table.getScanner(columns.to_java(java.lang.String))
+      end
       count = 0
       @formatter.header(["ROW", "COLUMN+CELL"])
       i = s.iterator()

Modified: hadoop/hbase/trunk/bin/hirb.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hirb.rb?rev=703025&r1=703024&r2=703025&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hirb.rb (original)
+++ hadoop/hbase/trunk/bin/hirb.rb Wed Oct  8 16:45:30 2008
@@ -175,17 +175,17 @@
 
            hbase> put 't1', 'r1', 'c1', 'value', ts1
 
- scan      Scan a table; pass table name and optionally an array of column
-           names OR an array of column names AND a dictionary of scanner 
-           specifications.  If you wish to include scanner specifications, 
-           you must also include an array of columns.  Scanner specifications 
-           may include one or more of the following: LIMIT, STARTROW, STOPROW,
-           or TIMESTAMP.  To scan all members of a column family, leave the 
-           qualifier empty as in 'col_family:'.  Examples:
+ scan      Scan a table; pass table name and optionally a dictionary of scanner 
+           specifications.  Scanner specifications may include one or more of 
+           the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS.  If 
+           no columns are specified, all columns will be scanned.  To scan all 
+           members of a column family, leave the qualifier empty as in 
+           'col_family:'.  Examples:
            
            hbase> scan '.META.'
-           hbase> scan '.META.', ['info:regioninfo']
-           hbase> scan 't1', ['c1', 'c2'], {LIMIT => 10, STARTROW => 'xyz'}
+           hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
+           hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
+             STARTROW => 'xyz'}
            
  version   Output this HBase version
 
@@ -271,8 +271,8 @@
   table(table).put(row, column, value, timestamp)
 end
   
-def scan(table, columns = [], args = {})
-  table(table).scan(columns, args)
+def scan(table, args = {})
+  table(table).scan(args)
 end
   
 def delete(table, row, column,