22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/hbase_thrift_ruby.rb', line 22
def get(table,columns,filters,obj={})
scan = HBase::TScan.new
scan.filterString = filters
scanner = scannerOpenWithScan(table, scan, obj)
results = []
scan_end = false
rows = []
while !scan_end
scan_result = scannerGet(scanner)
if scan_result.length > 0
rows << scan_result[0].row
else
scan_end = true
end
end
rows.each do |row|
row_results = []
if columns[0] == '*'
getRow(table,row,{})[0].columns.each do |val|
row_results << val[1].value
end
else
columns.each do |col|
col = "#{col}:" if col.match(/:/).nil?
row_results << getRow(table,row,{})[0].columns[col].value rescue row_results << nil
end
end
results << row_results
end
results
end
|