HBASE-852 Cannot scan all families in a row with a LIMIT, STARTROW, etc.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@703025 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-10-08 23:45:30 +00:00
parent 0a3560ccea
commit 252e017903
3 changed files with 28 additions and 26 deletions

View File

@ -5,6 +5,8 @@ Release 0.19.0 - Unreleased
(Doğacan Güney via Stack) (Doğacan Güney via Stack)
HBASE-905 Remove V5 migration classes from 0.19.0 (Jean-Daniel Cryans via HBASE-905 Remove V5 migration classes from 0.19.0 (Jean-Daniel Cryans via
Jim Kellerman) Jim Kellerman)
HBASE-852 Cannot scan all families in a row with a LIMIT, STARTROW, etc.
(Izaak Rubin via Stack)
BUG FIXES BUG FIXES
HBASE-891 HRS.validateValuesLength throws IOE, gets caught in the retries HBASE-891 HRS.validateValuesLength throws IOE, gets caught in the retries

View File

@ -223,33 +223,33 @@ module HBase
result result
end end
def scan(columns, args = {}) def scan(args = {})
now = Time.now 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 limit = -1
if args == nil or args.length <= 0 if args != nil and args.length > 0
s = @table.getScanner(cs)
else
limit = args["LIMIT"] || -1 limit = args["LIMIT"] || -1
filter = args["FILTER"] || nil filter = args["FILTER"] || nil
startrow = args["STARTROW"] || "" startrow = args["STARTROW"] || ""
stoprow = args["STOPROW"] || nil stoprow = args["STOPROW"] || nil
timestamp = args["TIMESTAMP"] || HConstants::LATEST_TIMESTAMP 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 if stoprow
s = @table.getScanner(cs, startrow, stoprow, timestamp) s = @table.getScanner(cs, startrow, stoprow, timestamp)
else else
s = @table.getScanner(cs, startrow, timestamp, filter) s = @table.getScanner(cs, startrow, timestamp, filter)
end end
end else
columns = getAllColumns()
s = @table.getScanner(columns.to_java(java.lang.String))
end
count = 0 count = 0
@formatter.header(["ROW", "COLUMN+CELL"]) @formatter.header(["ROW", "COLUMN+CELL"])
i = s.iterator() i = s.iterator()

View File

@ -175,17 +175,17 @@ HBASE SHELL COMMANDS:
hbase> put 't1', 'r1', 'c1', 'value', ts1 hbase> put 't1', 'r1', 'c1', 'value', ts1
scan Scan a table; pass table name and optionally an array of column scan Scan a table; pass table name and optionally a dictionary of scanner
names OR an array of column names AND a dictionary of scanner specifications. Scanner specifications may include one or more of
specifications. If you wish to include scanner specifications, the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If
you must also include an array of columns. Scanner specifications no columns are specified, all columns will be scanned. To scan all
may include one or more of the following: LIMIT, STARTROW, STOPROW, members of a column family, leave the qualifier empty as in
or TIMESTAMP. To scan all members of a column family, leave the 'col_family:'. Examples:
qualifier empty as in 'col_family:'. Examples:
hbase> scan '.META.' hbase> scan '.META.'
hbase> scan '.META.', ['info:regioninfo'] hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
hbase> scan 't1', ['c1', 'c2'], {LIMIT => 10, STARTROW => 'xyz'} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
STARTROW => 'xyz'}
version Output this HBase version version Output this HBase version
@ -271,8 +271,8 @@ def put(table, row, column, value, timestamp = nil)
table(table).put(row, column, value, timestamp) table(table).put(row, column, value, timestamp)
end end
def scan(table, columns = [], args = {}) def scan(table, args = {})
table(table).scan(columns, args) table(table).scan(args)
end end
def delete(table, row, column, def delete(table, row, column,