hbase-jruby 0.5.1-java → 0.6.0-java

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: c04d7e2d6f49d78fb778390c8711ce7bf627f15f
4
- data.tar.gz: 604381ab596d50cea5cea4f75367922dbe885ed1
3
+ metadata.gz: 156f951a80f9417d27674a2056eb3f71ed17329c
4
+ data.tar.gz: 5fa71d8f88ba39badc690da581f2ccc64a5ca7f3
5
5
  SHA512:
6
- metadata.gz: 93afab3c71ca6c297854e053b636d37a19f46af3be8c31ff78dc034dab53b664d60342db70875bce1161765eff60f0f00e920c86c11e3614fc65b97f01edb9c9
7
- data.tar.gz: 70bc34ecaa532528a0ca26a31a123ec66e517c74875d43e6d007c56aa6c7a0573eb511bf0abd0ae3907f93ba07c0656085c33365cb42ef0b1b0a12c7244a623c
6
+ metadata.gz: 7a21f92d008748eca8c1c333721939356092770a0425891fa1f575d5bac14a3c4b0570f843f0ea2ce31fdd5dc58b4b5b2576330446622e9046f5abcaa497989a
7
+ data.tar.gz: 4f6f2bf84a19fc129bd5d4263e87d3344a9199c60734a5b95d2d3ec476fe54c9433b573a7837767df3c826b47eb1e744fc65d61972f4ca5a2123269f8b7a86cb
@@ -1,6 +1,20 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.6.0
5
+ -----
6
+
7
+ 0.6.0 includes a few backward-incompatible changes.
8
+
9
+ - Default number of versions for a scan or get is now changed to 1 to match Java API
10
+ - Make sure to set versions to `:all` if you're calling `to_H` or plural datatype methods
11
+ - `scoped.versions(:all).to_H`
12
+ - `scoped.versions(:all).strings('d:title')`
13
+ - Removed `HBase::Table::BatchAction#mutate` method
14
+ - RowMutation is not allowed in `HBase::Table#batch`
15
+ - https://issues.apache.org/jira/browse/HBASE-11421
16
+ - Added CDH5.1 dependency profile
17
+
4
18
  0.5.1
5
19
  -----
6
20
  - Fixed `Table#aggregate` for HBase 0.98 or above
data/README.md CHANGED
@@ -96,7 +96,7 @@ table.put 1,
96
96
  price: BigDecimal('21.50'),
97
97
  weight: 3.0,
98
98
  in_print: true,
99
- image: File.open('thumbnail.png', 'rb') { |f| f.read }.to_java_bytes,
99
+ image: File.open('thumbnail.png', 'rb') { | f | f.read }.to_java_bytes,
100
100
  summary: 'A wide-ranging, comparative study of mythology and religion',
101
101
  reviews: 52,
102
102
  stars: 226,
@@ -123,7 +123,7 @@ table.range(0..100)
123
123
  category: ['Comics', 'Fiction', /cult/i],
124
124
  price: { lt: BigDecimal('30.00') },
125
125
  summary: /myth/i)
126
- .each do |book|
126
+ .each do | book |
127
127
 
128
128
  # Update columns
129
129
  table.put book.rowkey, price: book[:price] + BigDecimal('1')
@@ -152,21 +152,22 @@ or by `require`ing relevant JAR files after launching JRuby.
152
152
  Well, there's an easier way.
153
153
  Call `HBase.resolve_dependency!` helper method passing one of the arguments listed below.
154
154
 
155
- | Argument | Dependency | Default version | Required executable |
156
- | ---------- | ------------------------ | --------------- | ------------------- |
157
- | cdh5.0[.*] | Cloudera CDH5.0 | cdh5.0.0 | mvn |
158
- | cdh4.5[.*] | Cloudera CDH4.5 | cdh4.5.0 | mvn |
159
- | cdh4.4[.*] | Cloudera CDH4.4 | cdh4.4.0 | mvn |
160
- | cdh4.3[.*] | Cloudera CDH4.3 | cdh4.3.2 | mvn |
161
- | cdh4.2[.*] | Cloudera CDH4.2 | cdh4.2.2 | mvn |
162
- | cdh4.1[.*] | Cloudera CDH4.1 | cdh4.1.5 | mvn |
163
- | cdh3[u*] | Cloudera CDH3 | cdh3u6 | mvn |
164
- | 0.98[.*] | Apache HBase 0.98 | 0.98.0-hadoop2 | mvn |
165
- | 0.96[.*] | Apache HBase 0.96 | 0.96.2-hadoop2 | mvn |
166
- | 0.94[.*] | Apache HBase 0.94 | 0.94.18 | mvn |
167
- | 0.92[.*] | Apache HBase 0.92 | 0.92.2 | mvn |
168
- | *POM PATH* | Custom Maven POM file | - | mvn |
169
- | `:local` | Local HBase installation | - | hbase |
155
+ | Argument | Dependency | Default version | Required executable |
156
+ | ---------- | ------------------------ | --------------- | ------------------- |
157
+ | cdh5.1[.*] | Cloudera CDH5.1 | cdh5.1.0 | mvn |
158
+ | cdh5.0[.*] | Cloudera CDH5.0 | cdh5.0.0 | mvn |
159
+ | cdh4.5[.*] | Cloudera CDH4.5 | cdh4.5.0 | mvn |
160
+ | cdh4.4[.*] | Cloudera CDH4.4 | cdh4.4.0 | mvn |
161
+ | cdh4.3[.*] | Cloudera CDH4.3 | cdh4.3.2 | mvn |
162
+ | cdh4.2[.*] | Cloudera CDH4.2 | cdh4.2.2 | mvn |
163
+ | cdh4.1[.*] | Cloudera CDH4.1 | cdh4.1.5 | mvn |
164
+ | cdh3[u*] | Cloudera CDH3 | cdh3u6 | mvn |
165
+ | 0.98[.*] | Apache HBase 0.98 | 0.98.0-hadoop2 | mvn |
166
+ | 0.96[.*] | Apache HBase 0.96 | 0.96.2-hadoop2 | mvn |
167
+ | 0.94[.*] | Apache HBase 0.94 | 0.94.18 | mvn |
168
+ | 0.92[.*] | Apache HBase 0.92 | 0.92.2 | mvn |
169
+ | *POM PATH* | Custom Maven POM file | - | mvn |
170
+ | `:local` | Local HBase installation | - | hbase |
170
171
 
171
172
  (Default version is used when an argument prefix is given without specific patch version.
172
173
  e.g. `cdh4.2` defaults to `cdh4.2.2`)
@@ -261,7 +262,7 @@ table.create! cf1: {},
261
262
  | APPEND | Appends values to one or more columns within a single row |
262
263
  | Checked PUT/DELETE | Atomically checks if the pre-exising data matches the expected value and puts or deletes data |
263
264
  | MUTATE | Performs multiple mutations (PUTS and DELETES) atomically on a single row |
264
- | Batch execution | Performs multiple actions (PUT, GET, DELETE, INCREMENT, APPEND, and MUTATE) at once |
265
+ | Batch execution | Performs multiple actions (PUT, GET, DELETE, INCREMENT, APPEND) at once |
265
266
 
266
267
  ### Defining table schema for easier data access
267
268
 
@@ -348,7 +349,7 @@ year = book[:year]
348
349
  hash = book.to_h
349
350
 
350
351
  # Convert to Hash containing all versions of values indexed by their timestamps
351
- all_hash = book.to_H
352
+ all_hash = table.versions(:all).get('rowkey1').to_H
352
353
 
353
354
  # Columns not defined in the schema are returned as Java byte arrays
354
355
  # They need to be decoded manually
@@ -412,7 +413,7 @@ hash['cf2:10']
412
413
  hash[[:cf2, 10]]
413
414
  # byte[102, 111, 111, 98, 97, 114]@6f28bb44
414
415
 
415
- hash_with_versions = book.to_H
416
+ hash_with_versions = table.versions(:all).get(10000).to_H
416
417
  # {
417
418
  # :title => {1369019227766 => "Hello world"},
418
419
  # [:cf2, HBase::ByteArray<0, 0, 0, 0, 0, 0, 0, 10>] =>
@@ -539,17 +540,13 @@ ret = table.batch do |b|
539
540
  b.append rowkey3, 'cf1:b' => 'world'
540
541
  b.delete rowkey3, 'cf2', 'cf3:z'
541
542
  b.increment rowkey3, 'cf1:a' => 200, 'cf1:c' => 300
542
- b.mutate(rowkey4) do |m|
543
- m.put 'cf3:z' => 3.14
544
- m.delete 'cf3:y', 'cf4'
545
- end
546
543
  end
547
544
  ```
548
545
 
549
546
  `batch` method returns an Array of Hashes which contains the results of the
550
547
  actions in the order they are specified in the block. Each Hash has `:type` entry
551
548
  (:get, :put, :append, etc.) and `:result` entry. If the type of an action is
552
- :put, :delete, or :mutate, the `:result` will be given as a boolean. If it's an
549
+ :put or :delete, the `:result` will be given as a boolean. If it's an
553
550
  :increment or :append, a plain Hash will be returned as the `:result`, just like
554
551
  in [increment](https://github.com/junegunn/hbase-jruby#increment-atomic-increment-of-column-values)
555
552
  and [append](https://github.com/junegunn/hbase-jruby#append) methods.
@@ -12,6 +12,7 @@ class HBase
12
12
  # https://ccp.cloudera.com/display/SUPPORT/CDH+Downloads
13
13
  SUPPORTED_PROFILES = {
14
14
  # Prefix => Latest known version
15
+ 'cdh5.1' => 'cdh5.1.0',
15
16
  'cdh5.0' => 'cdh5.0.0',
16
17
  'cdh4.6' => 'cdh4.6.0',
17
18
  'cdh4.5' => 'cdh4.5.0',
@@ -10,13 +10,13 @@
10
10
  <name>hbase-jruby</name>
11
11
 
12
12
  <profiles>
13
- <% %w[cdh5.0].each do |cdh| %>
13
+ <% { 'cdh5.0' => '0.96.1.1', 'cdh5.1' => '0.98.1' }.each do |cdh, hbase_version| %>
14
14
  <profile>
15
15
  <id><%= cdh %></id>
16
16
  <properties>
17
17
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18
18
  <hadoop.version>2.3.0-<%= profiles[cdh] %></hadoop.version>
19
- <hbase.version>0.96.1.1-<%= profiles[cdh] %></hbase.version>
19
+ <hbase.version><%= hbase_version %>-<%= profiles[cdh] %></hbase.version>
20
20
  </properties>
21
21
  <repositories>
22
22
  <repository>
@@ -213,11 +213,13 @@ class Scoped
213
213
  end
214
214
 
215
215
  # Returns an HBase::Scoped object with the specified version number limit.
216
- # If not set, all versions of each value are fetched by default.
217
- # @param [Fixnum] vs Sets the maximum number of versions
216
+ # If not set or set to :all, all versions are fetched.
217
+ # @param [Fixnum|:all] vs Sets the maximum number of versions
218
218
  # @return [HBase::Scoped] HBase::Scoped object with the version number limit
219
219
  def versions vs
220
- raise ArgumentError, "Invalid versions. Must be a positive integer." unless vs.is_a?(Fixnum) && vs > 0
220
+ unless vs.is_a?(Fixnum) && vs > 0 || vs == :all
221
+ raise ArgumentError, "Invalid versions. Must be a positive integer or :all."
222
+ end
221
223
  spawn :@versions, vs
222
224
  end
223
225
 
@@ -350,11 +352,7 @@ private
350
352
 
351
353
  def getify rowkey
352
354
  Get.new(Util.to_bytes rowkey).tap { |get|
353
- if @versions
354
- get.setMaxVersions @versions
355
- else
356
- get.setMaxVersions
357
- end
355
+ set_max_versions get
358
356
 
359
357
  filters = []
360
358
  filters += process_projection!(get)
@@ -495,6 +493,15 @@ private
495
493
  end
496
494
  end
497
495
 
496
+ def set_max_versions obj
497
+ case @versions
498
+ when Fixnum
499
+ obj.setMaxVersions @versions
500
+ when :all
501
+ obj.setMaxVersions
502
+ end
503
+ end
504
+
498
505
  def filtered_scan
499
506
  Scan.new.tap { |scan|
500
507
  # Range
@@ -534,11 +541,7 @@ private
534
541
  end
535
542
 
536
543
  # Versions
537
- if @versions
538
- scan.setMaxVersions @versions
539
- else
540
- scan.setMaxVersions
541
- end
544
+ set_max_versions scan
542
545
 
543
546
  # Timerange / Timestamp
544
547
  case @trange
@@ -44,11 +44,6 @@ class BatchAction
44
44
  @actions << { :type => :increment, :action => @mutation.increment(*args) }
45
45
  end
46
46
 
47
- # @see HBase::Table#mutate
48
- def mutate *args, &blk
49
- @actions << { :type => :mutate, :action => @mutation.mutate(*args, &blk) }
50
- end
51
-
52
47
  [:get, :range, :project, :filter, :versions, :time_range, :at].each do |method|
53
48
  define_method(method) do |*args|
54
49
  BatchGetScoped.send(:new, @table.scoped, proc { |get|
@@ -1,5 +1,5 @@
1
1
  class HBase
2
2
  module JRuby
3
- VERSION = '0.5.1'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
@@ -54,6 +54,9 @@ class TestHBase < TestHBaseJRubyBase
54
54
  @hbase = connect
55
55
  table = @hbase[TABLE]
56
56
  assert_equal table.htable, Thread.current[:hbase_jruby][@hbase][TABLE]
57
+
58
+ # FIXME: Connection is closed, we have to update @table object
59
+ @table = @hbase.table(TABLE)
57
60
  end
58
61
 
59
62
  def test_admin
@@ -281,9 +281,18 @@ class TestSchema < TestHBaseJRubyBase
281
281
  # Coprocessor
282
282
  if @aggregation
283
283
  table.enable_aggregation!
284
+ # Expected:
285
+ # 844 = reviews(52) + inc(1) + stars(226) + inc(2 + 3) +
286
+ # put-review(100) + put-stars(500)
284
287
  table.put next_rowkey, :reviews => 100, :stars => 500
285
- assert_equal data[:reviews] + 1 + data[:stars] + 5 + 100 + 500,
288
+ assert_equal data[:reviews] + 1 + data[:stars] + 2 + 3 + 100 + 500,
286
289
  table.project(:reviews, :stars).aggregate(:sum)
290
+
291
+ assert_equal data[:reviews] + 1 + data[:stars] + 2 + 3 + 100 + 500,
292
+ table.project(:reviews, :stars).versions(1).aggregate(:sum)
293
+
294
+ assert_equal data[:reviews] * 2 + 1 + data[:stars] * 3 + 2 * 2 + 3 + 100 + 500,
295
+ table.project(:reviews, :stars).versions(:all).aggregate(:sum)
287
296
  #table.disable_aggregation!
288
297
  end
289
298
 
@@ -332,9 +341,7 @@ class TestSchema < TestHBaseJRubyBase
332
341
  assert_equal 'great', table.get(rk)[:comment4]
333
342
 
334
343
  # Batch
335
- # FIXME: Mutation in batch hangs on 0.96, temporarily using @aggregation
336
- # here to see if the version if 0.96 (no AggregationClient) or not
337
- mutation_in_batch = @aggregation
344
+ # XXX: Mutation in batch is no more allowed in 0.98
338
345
  ret = table.batch do |b|
339
346
  b.put rk, :comment5 => 'gnarly'
340
347
  b.delete rk, :comment4
@@ -346,26 +353,12 @@ class TestSchema < TestHBaseJRubyBase
346
353
  b.append rk, :category => '/Etc'
347
354
  b.get rk
348
355
 
349
- if mutation_in_batch
350
- b.mutate(rk) do |m|
351
- m.put :comment6 => 'rad'
352
- m.delete :image
353
- end
354
- else
355
- table.mutate(rk) do |m|
356
- m.put :comment6 => 'rad'
357
- m.delete :image
358
- end
359
- end
356
+ b.put rk, :comment6 => 'rad'
357
+ b.delete rk, :image
360
358
  end
361
359
 
362
- if mutation_in_batch
363
- assert_equal 6, ret.length
364
- assert_equal [true] * 3, ret.values_at(0, 1, 5).map { |r| r[:result] }
365
- else
366
- assert_equal 5, ret.length
367
- assert_equal [true] * 2, ret.values_at(0, 1).map { |r| r[:result] }
368
- end
360
+ assert_equal 7, ret.length
361
+ assert_equal [true] * 4, ret.values_at(0, 1, 5, 6).map { |r| r[:result] }
369
362
 
370
363
  assert_equal data[:stars] + 5 + 100, ret[2][:result][:stars]
371
364
  assert_equal data[:reviews] + 1 + 200, ret[2][:result][:reviews]
@@ -240,7 +240,7 @@ class TestScoped < TestHBaseJRubyBase
240
240
  insert.call
241
241
  [@table, @table.scoped].each do |table|
242
242
  # versions
243
- assert table.all? { |result| result.to_H[%w[cf1 a]].length == 2 }
243
+ assert table.versions(:all).all? { |result| result.to_H[%w[cf1 a]].length == 2 }
244
244
  assert table.versions(1).all? { |result| result.to_H[%w[cf1 a]].length == 1 }
245
245
  end
246
246
  end
@@ -131,21 +131,21 @@ class TestTable < TestHBaseJRubyBase
131
131
  # assert_equal [301, 401], @table.get(row1).int(['cf1:int', 'cf1:int2'])
132
132
 
133
133
  # single-get-multi-ver
134
- assert_equal [1, 2], @table.get(row1).fixnums('cf1:a').values
135
- assert_equal %w[a b], @table.get(row1).strings('cf1:b').values
136
- assert_equal %w[a b], @table.get(row1).raws('cf1:b').values.map { |v| String.from_java_bytes v }
137
- assert_equal %w[a b], @table.get(row1).byte_arrays('cf1:b').values.map { |v| v.as :string }
138
- assert_equal [3.14, 6.28], @table.get(row1).floats('cf1:c').values
139
- assert_equal [true, false], @table.get(row1).booleans('cf1:d').values
140
- assert_equal [:sym, :bol], @table.get(row1).symbols('cf1:f').values
134
+ assert_equal [1, 2], @table.versions(:all).get(row1).fixnums('cf1:a').values
135
+ assert_equal %w[a b], @table.versions(:all).get(row1).strings('cf1:b').values
136
+ assert_equal %w[a b], @table.versions(:all).get(row1).raws('cf1:b').values.map { |v| String.from_java_bytes v }
137
+ assert_equal %w[a b], @table.versions(:all).get(row1).byte_arrays('cf1:b').values.map { |v| v.as :string }
138
+ assert_equal [3.14, 6.28], @table.versions(:all).get(row1).floats('cf1:c').values
139
+ assert_equal [true, false], @table.versions(:all).get(row1).booleans('cf1:d').values
140
+ assert_equal [:sym, :bol], @table.versions(:all).get(row1).symbols('cf1:f').values
141
141
  assert_equal [
142
142
  BigDecimal.new("123.456"),
143
- BigDecimal.new("456.123")], @table.get(row1).bigdecimals('cf1:g').values
144
- assert_equal [101, 100], @table.get(row1).bytes('cf1:byte').values
145
- assert_equal [201, 200], @table.get(row1).shorts('cf1:short').values
146
- assert_equal [301, 300], @table.get(row1).ints('cf1:int').values
143
+ BigDecimal.new("456.123")], @table.versions(:all).get(row1).bigdecimals('cf1:g').values
144
+ assert_equal [101, 100], @table.versions(:all).get(row1).bytes('cf1:byte').values
145
+ assert_equal [201, 200], @table.versions(:all).get(row1).shorts('cf1:short').values
146
+ assert_equal [301, 300], @table.versions(:all).get(row1).ints('cf1:int').values
147
147
 
148
- assert @table.get(row1).fixnums('cf1:a').keys.all? { |k| k.instance_of? Fixnum }
148
+ assert @table.versions(:all).get(row1).fixnums('cf1:a').keys.all? { |k| k.instance_of? Fixnum }
149
149
 
150
150
  # single-get-multi-col-multi=ver (deprecated since 0.3)
151
151
  # rets = @table.get(row1).strings(['cf1:str1', 'cf1:str2'])
@@ -196,10 +196,10 @@ class TestTable < TestHBaseJRubyBase
196
196
  },
197
197
  }
198
198
 
199
- assert_equal [1270000000000, 'A3'], @table.get(rowkey).strings('cf1:a').first
200
- assert_equal 'A2', @table.get(rowkey).strings('cf1:a')[1260000000000]
201
- assert_equal [1250000000000, 'A1'], @table.get(rowkey).strings('cf1:a').to_a.last
202
- assert_equal ['B1'], @table.get(rowkey).strings('cf1:b').values
199
+ assert_equal [1270000000000, 'A3'], @table.versions(:all).get(rowkey).strings('cf1:a').first
200
+ assert_equal 'A2', @table.versions(:all).get(rowkey).strings('cf1:a')[1260000000000]
201
+ assert_equal [1250000000000, 'A1'], @table.versions(:all).get(rowkey).strings('cf1:a').to_a.last
202
+ assert_equal ['B1'], @table.versions(:all).get(rowkey).strings('cf1:b').values
203
203
  end
204
204
 
205
205
  def test_increment
@@ -250,13 +250,13 @@ class TestTable < TestHBaseJRubyBase
250
250
  @table.put(row1, 'cf2:d' => 5)
251
251
  sleep 0.1
252
252
  @table.put(row1, 'cf2:d' => 6)
253
- versions = @table.get(row1).to_H[%w[cf2 d]].keys
253
+ versions = @table.versions(:all).get(row1).to_H[%w[cf2 d]].keys
254
254
  assert versions[0] > versions[1]
255
255
  assert versions[1] > versions[2]
256
256
 
257
257
  # Deletes a version (Fixnum and Time as timestamps)
258
258
  @table.delete(row1, 'cf2:d', versions[0], Time.at(versions[2] / 1000.0))
259
- new_versions = @table.get(row1).to_H[%w[cf2 d]].keys
259
+ new_versions = @table.versions(:all).get(row1).to_H[%w[cf2 d]].keys
260
260
  assert_equal new_versions, [versions[1]]
261
261
 
262
262
  # Deletes a column
@@ -312,10 +312,10 @@ class TestTable < TestHBaseJRubyBase
312
312
 
313
313
  assert_equal 3, @table.get(drow).to_h.keys.length
314
314
 
315
- assert_equal 1, @table.get(drow).to_H['cf1:a'].length
316
- assert_equal 2, @table.get(drow).to_H['cf1:b'].length
317
- assert_equal 3000, @table.get(drow).to_H['cf1:a'].keys.first
318
- assert_equal [6000, 4000], @table.get(drow).to_H['cf1:b'].keys
315
+ assert_equal 1, @table.versions(:all).get(drow).to_H['cf1:a'].length
316
+ assert_equal 2, @table.versions(:all).get(drow).to_H['cf1:b'].length
317
+ assert_equal 3000, @table.versions(:all).get(drow).to_H['cf1:a'].keys.first
318
+ assert_equal [6000, 4000], @table.versions(:all).get(drow).to_H['cf1:b'].keys
319
319
  end
320
320
 
321
321
  def test_delete_advanced_with_schema
@@ -354,10 +354,10 @@ class TestTable < TestHBaseJRubyBase
354
354
 
355
355
  assert_equal 3, @table.get(drow).to_h.keys.length
356
356
 
357
- assert_equal 1, @table.get(drow).to_H[:a].length
358
- assert_equal 2, @table.get(drow).to_H[:b].length
359
- assert_equal 3000, @table.get(drow).to_H[:a].keys.first
360
- assert_equal [6000, 4000], @table.get(drow).to_H[:b].keys
357
+ assert_equal 1, @table.versions(:all).get(drow).to_H[:a].length
358
+ assert_equal 2, @table.versions(:all).get(drow).to_H[:b].length
359
+ assert_equal 3000, @table.versions(:all).get(drow).to_H[:a].keys.first
360
+ assert_equal [6000, 4000], @table.versions(:all).get(drow).to_H[:b].keys
361
361
  end
362
362
 
363
363
  def test_delete_row
@@ -438,7 +438,7 @@ class TestTable < TestHBaseJRubyBase
438
438
  @table.put rk, a => 100, b => 200,
439
439
  c => { ts => 300, (ts - 1000) => 400, (ts - 2000).to_i => 500 },
440
440
  d => 1000
441
- assert_equal 3, @table.get(rk).to_H[:c].length
441
+ assert_equal 3, @table.versions(:all).get(rk).to_H[:c].length
442
442
 
443
443
  assert_equal false, @table.check(rk, a => 200).delete(b)
444
444
  assert_equal 200, @table.get(rk)[b]
@@ -447,8 +447,8 @@ class TestTable < TestHBaseJRubyBase
447
447
  assert_equal nil, @table.get(rk)[b]
448
448
 
449
449
  assert_equal true, @table.check(rk, a => 100).delete(c, ts, (ts - 2000).to_i, 'cf2')
450
- assert_equal 1, @table.get(rk).to_H[:c].length
451
- assert_equal (ts - 1000).to_i, @table.get(rk).to_H[:c].keys.first / 1000
450
+ assert_equal 1, @table.versions(:all).get(rk).to_H[:c].length
451
+ assert_equal (ts - 1000).to_i, @table.versions(:all).get(rk).to_H[:c].keys.first / 1000
452
452
  assert_equal nil, @table.get(rk)[d]
453
453
 
454
454
  assert_equal true, @table.check(rk, a => 100).delete
@@ -521,8 +521,6 @@ class TestTable < TestHBaseJRubyBase
521
521
  assert_equal true, ret[1][:result]
522
522
  assert_equal true, ret[2][:result]
523
523
 
524
- # FIXME: Mutation in batch hangs on 0.96
525
- mutation_in_batch = @aggregation
526
524
  ret = @table.batch { |b|
527
525
  b.put rk3, 'cf1:c' => 5
528
526
  b.delete rk1, 'cf1:a'
@@ -531,29 +529,13 @@ class TestTable < TestHBaseJRubyBase
531
529
  b.get(rk1)
532
530
  b.filter('cf1:a' => 0).get(rk1)
533
531
  b.versions(1).project('cf2').get(rk1)
534
- if mutation_in_batch
535
- b.mutate(rk3) do |m|
536
- m.put 'cf2:d' => 'hola'
537
- m.put 'cf2:e' => 'mundo'
538
- m.delete 'cf1:b'
539
- end
540
- else
541
- @table.mutate(rk3) do |m|
542
- m.put 'cf2:d' => 'hola'
543
- m.put 'cf2:e' => 'mundo'
544
- m.delete 'cf1:b'
545
- end
546
- end
532
+ b.put rk3, 'cf2:d' => 'hola'
533
+ b.put rk3, 'cf2:e' => 'mundo'
534
+ b.delete rk3, 'cf1:b'
547
535
  }
548
- if mutation_in_batch
549
- assert_equal 8, ret.length
550
- assert_equal [:put, :delete, :increment, :append, :get, :get, :get, :mutate], ret.map { |r| r[:type] }
551
- assert_equal [true, true, true], ret.values_at(0, 1, 7).map { |r| r[:result] }
552
- else
553
- assert_equal 7, ret.length
554
- assert_equal [:put, :delete, :increment, :append, :get, :get, :get], ret.map { |r| r[:type] }
555
- assert_equal [true, true], ret.values_at(0, 1).map { |r| r[:result] }
556
- end
536
+ assert_equal [:put, :delete, :increment, :append, :get, :get, :get, :put, :put, :delete], ret.map { |r| r[:type] }
537
+ assert_equal [true, true], ret.values_at(0, 1).map { |r| r[:result] }
538
+
557
539
  assert_equal 12, ret[2][:result]['cf1:a']
558
540
  assert_equal 23, ret[2][:result]['cf1:b']
559
541
  assert_equal 'hello world', ret[3][:result]['cf2:c'].to_s
@@ -143,7 +143,7 @@ class TestTableAdmin < TestHBaseJRubyBase
143
143
  end
144
144
 
145
145
  def test_add_coprocessor!
146
- omit "AggregationClient is removed in 0.96" unless @aggregation
146
+ omit "AggregationClient not found" unless @aggregation
147
147
 
148
148
  coproc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation'
149
149
  assert_false @table.has_coprocessor? coproc
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hbase-jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: java
6
6
  authors:
7
7
  - Junegunn Choi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit