forward-rbase 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rbase/table.rb +12 -0
- metadata +3 -3
data/lib/rbase/table.rb
CHANGED
@@ -24,6 +24,18 @@ module Rbase
|
|
24
24
|
end
|
25
25
|
alias_method :[]=, :insert
|
26
26
|
|
27
|
+
def multi_insert(rows)
|
28
|
+
row_mutations = rows.map do |row, hash|
|
29
|
+
hash.map do |family,value|
|
30
|
+
mutations = value.map do |column,val|
|
31
|
+
Apache::Hadoop::Hbase::Thrift::Mutation.new(:column => "#{family}:#{column}", :value => val)
|
32
|
+
end
|
33
|
+
Apache::Hadoop::Hbase::Thrift::BatchMutation.new(:row => row, :mutations => mutations)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
@client.mutateRows(@table_name, row_mutations.flatten)
|
37
|
+
end
|
38
|
+
|
27
39
|
def each_batch(batch_size=100, columns=[])
|
28
40
|
columns = [columns] unless columns.is_a?(Array)
|
29
41
|
scanner_id = @client.scannerOpen(@table_name, '', columns)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forward-rbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Forward Internet Group
|