hbase-jruby 0.7.0-java → 0.7.1-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: 0714705c9427de687d1657774b34d8126ef10dbd
4
- data.tar.gz: 768ac4c28e4709151a665290402f2a3fe573aefb
3
+ metadata.gz: a11f20dabc1a006d84c0d657e878a706f3c04e11
4
+ data.tar.gz: 80d648377fbc94157cf5c8addcfcabc15a06c30d
5
5
  SHA512:
6
- metadata.gz: 2102cbfca64c12be4addf08d0c6526549fe7f25923c079b89510d0a3404d1e64245d9feac24299c9ae10ff8533f2e8aaedf08d4859af5158fcea815a34e7ba14
7
- data.tar.gz: dfb7325181769b6e57319c072d874f2b01dce456edaad2c7d33590eda98963b9b05a5540d7856b0df85253a900d39fe4829d047bde990ca18346b810a6d92858
6
+ metadata.gz: 3b586cf5138693aac0b2e34025d413a65d91d22053e7d3b3ae3d6cc2a2121df1080e445b72f11ad6d3b2ad23e6c4642e1dbaefeb31f0e749e9251b599aa6e5aa
7
+ data.tar.gz: 70476d6fcda145a3d5b703748cabc72da20ebe82fe49149858e32c7513affa8621733f9eb5d723ec686935565d9bafadf6a45f2a7489cedfc634113dbf085aec
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.7.1
5
+ -----
6
+
7
+ - Support setting one timestamp for all columns (#41)
8
+
4
9
  0.7.0
5
10
  -----
6
11
 
data/README.md CHANGED
@@ -53,7 +53,7 @@ hbase = HBase.new 'localhost'
53
53
  # Table object
54
54
  table = hbase[:test_table]
55
55
  table.drop! if table.exists?
56
- table.create! :cf1, :cf2
56
+ table.create! :cf1 => {}, :cf2 => {}
57
57
 
58
58
  # PUT
59
59
  table.put 'rowkey1' => { 'cf1:a' => 100, 'cf2:b' => 'Hello' },
@@ -326,16 +326,25 @@ table.put 'rowkey1', title: "Hello World", year: 2013
326
326
 
327
327
  # Putting multiple rows
328
328
  table.put 'rowkey1' => { title: 'foo', year: 2013 },
329
- 'rowkey2' => { title: "bar", year: 2014 },
329
+ 'rowkey2' => { title: 'bar', year: 2014 },
330
330
  'rowkey3' => { title: 'foobar', year: 2015 }
331
331
 
332
332
  # Putting values with timestamps
333
333
  table.put 'rowkey1',
334
334
  title: {
335
- 1353143856665 => "Hello world",
336
- 1352978648642 => "Goodbye world"
335
+ 1353143856665 => 'Hello world',
336
+ 1352978648642 => 'Goodbye world'
337
337
  },
338
338
  year: 2013
339
+
340
+ # Putting values with the same timestamp
341
+ table.put('rowkey1',
342
+ {
343
+ title: 'foo',
344
+ year: 2016
345
+ },
346
+ 1463678960135
347
+ )
339
348
  ```
340
349
 
341
350
  ### GET
@@ -1254,17 +1263,10 @@ ba.java # Returns the native Java byte array (byte[])
1254
1263
  ## Test
1255
1264
 
1256
1265
  ```bash
1257
- #!/bin/bash
1258
-
1259
- # Test HBase 0.94 on localhost
1260
- export HBASE_JRUBY_TEST_ZK='127.0.0.1'
1261
- export HBASE_JRUBY_TEST_DIST='0.94'
1262
-
1263
- # Test both for 1.8 and 1.9
1264
- for v in --1.8 --1.9; do
1265
- export JRUBY_OPTS=$v
1266
- rake test
1267
- done
1266
+ export CLASSPATH=hbase-client-dep-1.2.jar
1267
+ export HBASE_JRUBY_TEST_ZK=localhost
1268
+ export JRUBY_OPTS=--debug
1269
+ jrake test TESTOPTS=-v
1268
1270
  ```
1269
1271
 
1270
1272
  ## Contributing
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
20
  gem.require_paths = ["lib"]
21
21
 
22
+ gem.add_development_dependency 'minitest'
22
23
  gem.add_development_dependency 'yard'
23
24
  gem.add_development_dependency 'simplecov'
24
25
  end
@@ -73,7 +73,7 @@ class Table
73
73
  puts = args.first.map { |rowkey, props| @mutation.put rowkey, props }
74
74
  htable.put puts
75
75
  puts.length
76
- when 2
76
+ when 2, 3
77
77
  htable.put @mutation.put(*args)
78
78
  1
79
79
  else
@@ -8,7 +8,7 @@ class Mutation
8
8
  @table = table
9
9
  end
10
10
 
11
- def put rowkey, props
11
+ def put rowkey, props, timestamp = nil
12
12
  Put.new(Util.to_bytes rowkey).tap { |put|
13
13
  props.each do |col, val|
14
14
  next if val.nil?
@@ -28,9 +28,17 @@ class Mutation
28
28
  end unless v.nil?
29
29
  end
30
30
  when String
31
- put.add cf, cq, val.to_java_bytes
31
+ if timestamp
32
+ put.add cf, cq, time_to_long(timestamp), val.to_java_bytes
33
+ else
34
+ put.add cf, cq, val.to_java_bytes
35
+ end
32
36
  else
33
- put.add cf, cq, Util.to_typed_bytes(type, val)
37
+ if timestamp
38
+ put.add cf, cq, time_to_long(timestamp), Util.to_typed_bytes(type, val)
39
+ else
40
+ put.add cf, cq, Util.to_typed_bytes(type, val)
41
+ end
34
42
  end
35
43
  end
36
44
  raise ArgumentError, "no column to put" if put.empty?
@@ -1,5 +1,5 @@
1
1
  class HBase
2
2
  module JRuby
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
  end
5
5
  end
@@ -1,9 +1,8 @@
1
1
  $VERBOSE = true
2
2
 
3
- require 'minitest/autorun'
4
3
  require 'simplecov'
5
4
  SimpleCov.start
6
-
5
+ require 'minitest/autorun'
7
6
  RECREATE = false
8
7
 
9
8
  unless defined? Enumerator
@@ -21,7 +20,7 @@ HBase.log4j = { 'log4j.threshold' => 'ERROR' }
21
20
 
22
21
  class TestHBaseJRubyBase < Minitest::Test
23
22
  TABLE = 'test_hbase_jruby'
24
- ZK = ENV.fetch 'HBASE_JRUBY_TEST_ZK'
23
+ ZK = ENV.fetch('HBASE_JRUBY_TEST_ZK', 'localhost')
25
24
 
26
25
  # Initialize
27
26
  hbase = HBase.new 'hbase.zookeeper.quorum' => ZK
@@ -4,17 +4,6 @@ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
4
4
  require 'helper'
5
5
 
6
6
  class TestHBase < TestHBaseJRubyBase
7
- def test_log4j
8
- HBase.log4j = File.expand_path('../log4j/log4j.properties', __FILE__)
9
- HBase.log4j = File.expand_path('../log4j/log4j.xml', __FILE__)
10
-
11
- begin
12
- HBase.log4j = File.expand_path('../log4j/log4j_invalid.xml', __FILE__)
13
- assert false, "Exception must be thrown when invalid XML is given"
14
- rescue Exception
15
- end
16
- end
17
-
18
7
  def test_tables
19
8
  assert @hbase.table_names.include?(TABLE)
20
9
  assert @hbase.list.include?(TABLE)
@@ -147,8 +147,9 @@ class TestTable < TestHBaseJRubyBase
147
147
  assert_equal 'A1', @table.get(rowkey).string('cf1:pdp')
148
148
  end
149
149
 
150
- def test_put_timestamp
150
+ def test_put_timestamp_per_column
151
151
  rowkey = next_rowkey
152
+
152
153
  @table.put rowkey => {
153
154
  'cf1:b' => 'B1',
154
155
  'cf1:a' => {
@@ -164,6 +165,21 @@ class TestTable < TestHBaseJRubyBase
164
165
  assert_equal ['B1'], @table.versions(:all).get(rowkey).strings('cf1:b').values
165
166
  end
166
167
 
168
+ def test_put_timestamp_for_all_columns
169
+ rowkey = next_rowkey
170
+
171
+ # Fixnum timestamp support.
172
+ @table.put(rowkey, { 'cf1:a' => 'A4' }, 1280000000000)
173
+
174
+ assert_equal 'A4', @table.versions(:all).get(rowkey).strings('cf1:a')[1280000000000]
175
+
176
+ # Ruby Time timestamp support.
177
+ @table.put(rowkey, { 'cf1:a' => 'A5', 'cf1:b' => 777 }, Time.at(1290000000))
178
+
179
+ assert_equal 'A5', @table.versions(:all).get(rowkey).strings('cf1:a')[1290000000000]
180
+ assert_equal 777, @table.versions(:all).get(rowkey).fixnums('cf1:b')[1290000000000]
181
+ end
182
+
167
183
  def test_increment
168
184
  row1 = next_rowkey.to_s
169
185
  row2 = next_rowkey.to_s
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hbase-jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: java
6
6
  authors:
7
7
  - Junegunn Choi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2016-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: yard
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
15
22
  version_requirements: !ruby/object:Gem::Requirement
16
23
  requirements:
17
24
  - - ">="
18
25
  - !ruby/object:Gem::Version
19
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
20
29
  requirement: !ruby/object:Gem::Requirement
21
30
  requirements:
22
31
  - - ">="
23
32
  - !ruby/object:Gem::Version
24
33
  version: '0'
25
- prerelease: false
26
34
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: simplecov
35
+ prerelease: false
29
36
  version_requirements: !ruby/object:Gem::Requirement
30
37
  requirements:
31
38
  - - ">="
32
39
  - !ruby/object:Gem::Version
33
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
34
43
  requirement: !ruby/object:Gem::Requirement
35
44
  requirements:
36
45
  - - ">="
37
46
  - !ruby/object:Gem::Version
38
47
  version: '0'
39
- prerelease: false
40
48
  type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: A JRuby binding for HBase
42
56
  email:
43
57
  - junegunn.c@gmail.com
@@ -86,7 +100,7 @@ homepage: https://github.com/junegunn/hbase-jruby
86
100
  licenses:
87
101
  - MIT
88
102
  metadata: {}
89
- post_install_message:
103
+ post_install_message:
90
104
  rdoc_options: []
91
105
  require_paths:
92
106
  - lib
@@ -101,9 +115,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
103
117
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.4.8
106
- signing_key:
118
+ rubyforge_project:
119
+ rubygems_version: 2.4.5.1
120
+ signing_key:
107
121
  specification_version: 4
108
122
  summary: A JRuby binding for HBase
109
123
  test_files:
@@ -117,4 +131,3 @@ test_files:
117
131
  - test/test_table.rb
118
132
  - test/test_table_admin.rb
119
133
  - test/test_util.rb
120
- has_rdoc: