hipster_sql_to_hbase 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/hipster_sql_to_hbase.gemspec +1 -1
- data/lib/adapter/hbase.rb +9 -14
- data/lib/result_tree_to_hbase_converter.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21aa3a9f2162b1887138ca8e123895d18a474c58
|
4
|
+
data.tar.gz: c7a905d57e231b9368d389fb59632d45c450676b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3e3a61c3eeb144623e2d8e1681413ddaf875b4fa5f8ad7f3e5ec1bcfa6aa286e40ea064039056ffda8a0f4376bdc8548ef48287ba94a45b5aa2fb35b765af96
|
7
|
+
data.tar.gz: ec656c0165aefa7f856541246e9133b7e8f7ae62b2f41d5fba2dfac1489da1a9fc46b3de88b99a1cb2270239ba1307c48aad4f82d42f5ce2a39c3385ff4dfbe7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/adapter/hbase.rb
CHANGED
@@ -19,28 +19,23 @@ module Hbase
|
|
19
19
|
mutateRow('table_indices','0',[HBase::Mutation.new(column: table_name, value: n_row.to_s)],{})
|
20
20
|
c_row
|
21
21
|
end
|
22
|
-
def getRowsByScanner(table,columns,filters,obj={})
|
22
|
+
def getRowsByScanner(table,columns,filters,limit,obj={})
|
23
23
|
scan = HBase::TScan.new
|
24
24
|
filters = "(RowFilter(>=, 'binary:0'))" if filters == ''
|
25
25
|
scan.filterString = filters
|
26
26
|
scanner = scannerOpenWithScan(table, scan, obj)
|
27
27
|
|
28
28
|
results = []
|
29
|
-
|
29
|
+
scan_limit = limit || 100000
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
if
|
34
|
-
|
35
|
-
results << scan_result[0].columns.each{ |k,v| scan_result[0].columns[k] = v.value }
|
36
|
-
else
|
37
|
-
row_result = {}
|
38
|
-
columns.each{ |k| row_result[k] = scan_result[0].columns[k].value }
|
39
|
-
results << row_result
|
40
|
-
end
|
31
|
+
rows = scannerGetList(scanner, scan_limit)
|
32
|
+
rows.each do |row|
|
33
|
+
if columns[0] == '*'
|
34
|
+
results << row.columns.each{ |k,v| row.columns[k] = v.value }
|
41
35
|
else
|
42
|
-
|
43
|
-
|
36
|
+
row_result = {}
|
37
|
+
columns.each{ |k| row_result[k] = row.columns[k].value }
|
38
|
+
results << row_result
|
44
39
|
end
|
45
40
|
end
|
46
41
|
|
@@ -56,8 +56,9 @@ module HipsterSqlToHbase
|
|
56
56
|
thrift_table = hash[:from]
|
57
57
|
thrift_columns = hash[:select]
|
58
58
|
thrift_filters = recurse_where(hash[:where] || [])
|
59
|
+
thrift_limit = hash[:limit]
|
59
60
|
|
60
|
-
HipsterSqlToHbase::ThriftCallGroup.new([{:method => thrift_method,:arguments => [thrift_table,thrift_columns,thrift_filters,{}]}])
|
61
|
+
HipsterSqlToHbase::ThriftCallGroup.new([{:method => thrift_method,:arguments => [thrift_table,thrift_columns,thrift_filters,thrift_limit,{}]}])
|
61
62
|
end
|
62
63
|
|
63
64
|
# When SQL sentence is a CREATE TABLE query generate the Thrift column descriptors/families
|