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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bc7e0fadc9bd39437ea73714c653ec0377b8a7d
4
- data.tar.gz: 9b85004f1f55df39cf4edf80cac0754fee31be57
3
+ metadata.gz: 21aa3a9f2162b1887138ca8e123895d18a474c58
4
+ data.tar.gz: c7a905d57e231b9368d389fb59632d45c450676b
5
5
  SHA512:
6
- metadata.gz: 610c323c98794ff3ebc804388aa857a8179b27339f4f1de3f79cba8f9d3a3d2801b51a6b1449f1d63c05185d42a236109a9dfceb8f1e8440873f550ede460de2
7
- data.tar.gz: 1e6bb0a3e95843438981a57e7c50275924acf3423b1783e044017b3f79ef309bcfb70df37c88ac58c6beeccadc9bbff2d5d758644a6631937306e33247d21c04
6
+ metadata.gz: a3e3a61c3eeb144623e2d8e1681413ddaf875b4fa5f8ad7f3e5ec1bcfa6aa286e40ea064039056ffda8a0f4376bdc8548ef48287ba94a45b5aa2fb35b765af96
7
+ data.tar.gz: ec656c0165aefa7f856541246e9133b7e8f7ae62b2f41d5fba2dfac1489da1a9fc46b3de88b99a1cb2270239ba1307c48aad4f82d42f5ce2a39c3385ff4dfbe7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "hipster_sql_to_hbase"
5
- s.version = "0.1.6"
5
+ s.version = "0.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jean Lescure"]
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
- scan_end = false
29
+ scan_limit = limit || 100000
30
30
 
31
- while !scan_end
32
- scan_result = scannerGet(scanner)
33
- if scan_result.length > 0
34
- if columns[0] == '*'
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
- scannerClose(scanner)
43
- scan_end = true
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipster_sql_to_hbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Lescure