diff --git a/CHANGES.txt b/CHANGES.txt index 1fb64375b4e..7c067c305b0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Release 0.19.0 - Unreleased (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 diff --git a/bin/HBase.rb b/bin/HBase.rb index 5e0d28eeb8c..6097c352905 100644 --- a/bin/HBase.rb +++ b/bin/HBase.rb @@ -223,33 +223,33 @@ module HBase 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() diff --git a/bin/hirb.rb b/bin/hirb.rb index 1a3a000c0f4..fe89bb44970 100644 --- a/bin/hirb.rb +++ b/bin/hirb.rb @@ -175,17 +175,17 @@ HBASE SHELL COMMANDS: 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 @@ def put(table, row, column, value, timestamp = nil) 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,