hbase-jruby 0.4.1-java → 0.4.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb5332ec468aee60e38e869db395bbae44796a7a
4
+ data.tar.gz: 8379861af0be920e67f705b6a1bafbcf96a18a02
5
+ SHA512:
6
+ metadata.gz: 4c934c7adf252bd2fd4830ac63d6e6322ae565be624dce270c9faac060814db8087d39ac9522bf4db121002efae828e120828266d29fd9d53a77501890c2a0b2
7
+ data.tar.gz: 19b0b3208669c141bfeeff7f19ae2785b1b16c66c924d8b7da92588bfaff4c156b33f481e596b95355cdd49df92d3c9e3b9fa122b6f6effb81e049f8562785eb
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.4.2
5
+ -----
6
+ - Fixed bug when using schema with non-String/Symbol qualifier
7
+ - Updated dependency profiles
8
+ - Added CDH4.5, CDH4.4 (same as CDH4.3)
9
+ - 0.95, 0.96 (experimental, currently not working)
10
+ - Improved compatibility with HBase shell which is based on JRuby 1.6.5
11
+
4
12
  0.4.1
5
13
  -----
6
14
  - Fixed .META. scanning with range prefix ([#26](https://github.com/junegunn/hbase-jruby/issues/26))
data/README.md CHANGED
@@ -150,12 +150,13 @@ Call `HBase.resolve_dependency!` helper method passing one of the arguments list
150
150
 
151
151
  | Argument | Dependency | Default version | Required executable |
152
152
  | ---------- | ------------------------ | --------------- | ------------------- |
153
- | cdh4.3[.*] | Cloudera CDH4.3 | cdh4.3.0 | mvn |
154
- | cdh4.2[.*] | Cloudera CDH4.2 | cdh4.2.1 | mvn |
155
- | cdh4.1[.*] | Cloudera CDH4.1 | cdh4.1.4 | mvn |
153
+ | cdh4.5[.*] | Cloudera CDH4.5 | cdh4.5.0 | mvn |
154
+ | cdh4.4[.*] | Cloudera CDH4.4 | cdh4.4.0 | mvn |
155
+ | cdh4.3[.*] | Cloudera CDH4.3 | cdh4.3.2 | mvn |
156
+ | cdh4.2[.*] | Cloudera CDH4.2 | cdh4.2.2 | mvn |
157
+ | cdh4.1[.*] | Cloudera CDH4.1 | cdh4.1.5 | mvn |
156
158
  | cdh3[u*] | Cloudera CDH3 | cdh3u6 | mvn |
157
- | 0.95[.*] | Apache HBase 0.95 | 0.95.0 | mvn |
158
- | 0.94[.*] | Apache HBase 0.94 | 0.94.9 | mvn |
159
+ | 0.94[.*] | Apache HBase 0.94 | 0.94.13 | mvn |
159
160
  | 0.92[.*] | Apache HBase 0.92 | 0.92.2 | mvn |
160
161
  | *POM PATH* | Custom Maven POM file | - | mvn |
161
162
  | `:local` | Local HBase installation | - | hbase |
@@ -1213,6 +1214,10 @@ ba.shift(:string, 11) # Byte length must be given as Strings are not fixed in s
1213
1214
  ba.java # Returns the native Java byte array (byte[])
1214
1215
  ```
1215
1216
 
1217
+ ## API documentation
1218
+
1219
+ [http://rubydoc.info/gems/hbase-jruby/0.4.1/frames](http://rubydoc.info/gems/hbase-jruby/0.4.1/frames)
1220
+
1216
1221
  ## Test
1217
1222
 
1218
1223
  ```bash
@@ -12,19 +12,22 @@ class HBase
12
12
  # https://ccp.cloudera.com/display/SUPPORT/CDH+Downloads
13
13
  SUPPORTED_PROFILES = {
14
14
  # Prefix => Latest known version
15
- 'cdh4.3' => 'cdh4.3.0',
16
- 'cdh4.2' => 'cdh4.2.1',
17
- 'cdh4.1' => 'cdh4.1.4',
15
+ 'cdh4.5' => 'cdh4.5.0',
16
+ 'cdh4.4' => 'cdh4.4.0',
17
+ 'cdh4.3' => 'cdh4.3.2',
18
+ 'cdh4.2' => 'cdh4.2.2',
19
+ 'cdh4.1' => 'cdh4.1.5',
18
20
  'cdh3' => 'cdh3u6',
19
- '0.95' => '0.95.0',
20
- '0.94' => '0.94.9',
21
+ '0.96' => '0.96.1.1-hadoop2',
22
+ '0.95' => '0.95.2-hadoop2',
23
+ '0.94' => '0.94.15',
21
24
  '0.92' => '0.92.2',
22
25
  }
23
26
 
24
27
  class << self
25
28
  # @overload resolve_dependency!(dist, options)
26
29
  # Resolve Hadoop and HBase dependency with a predefined Maven profile
27
- # @param [String] dist HBase distribution: cdh4.2, cdh4.1, cdh3, 0.94, 0.92, local
30
+ # @param [String] dist HBase distribution: cdh4.[1-5], cdh3, 0.94, 0.92, local
28
31
  # @param [Hash] options Options
29
32
  # @option options [Boolean] :verbose Enable verbose output
30
33
  # @return [Array<String>] Loaded JAR files
@@ -65,7 +68,7 @@ class HBase
65
68
  else
66
69
  matched_profiles = SUPPORTED_PROFILES.keys.select { |pf| dist.start_with? pf }
67
70
  if matched_profiles.length != 1
68
- raise ArgumentError, "Invalid profile: #{dist}"
71
+ raise ArgumentError, "Unknown profile: #{dist}"
69
72
  end
70
73
  matched_profile = matched_profiles.first
71
74
  profiles = SUPPORTED_PROFILES.dup
@@ -81,9 +84,15 @@ class HBase
81
84
  # Download dependent JAR files and build classpath string
82
85
  tempfiles << tf = Tempfile.new('hbase-jruby-classpath')
83
86
  tf.close(false)
84
- system "mvn org.apache.maven.plugins:maven-dependency-plugin:2.5.1:resolve org.apache.maven.plugins:maven-dependency-plugin:2.5.1:build-classpath -Dsilent=true -Dmdep.outputFile=#{tf.path} #{profile} -f #{path} #{silencer}"
85
-
86
- raise RuntimeError.new("Error occurred. Set verbose option to see the log.") unless $?.exitstatus == 0
87
+ system("mvn org.apache.maven.plugins:maven-dependency-plugin:2.5.1:resolve " <<
88
+ "org.apache.maven.plugins:maven-dependency-plugin:2.5.1:build-classpath " <<
89
+ "-Dsilent=true -Dmdep.outputFile=#{tf.path} #{profile} -f #{path} #{silencer}")
90
+
91
+ unless $?.exitstatus == 0
92
+ message = "Error occurred."
93
+ message << " Set verbose option to see the log." unless verbose
94
+ raise RuntimeError.new(message)
95
+ end
87
96
 
88
97
  if File.read(tf.path).empty?
89
98
  desc =
@@ -10,13 +10,14 @@
10
10
  <name>hbase-jruby</name>
11
11
 
12
12
  <profiles>
13
+ <% %w[cdh4.5 cdh4.4 cdh4.3].each do |cdh| %>
13
14
  <profile>
14
- <!-- http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Installation-Guide/cdh4ig_topic_31.html -->
15
- <id>cdh4.3</id>
15
+ <!-- http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH-Version-and-Packaging-Information/cdhvd_topic_8.html -->
16
+ <id><%= cdh %></id>
16
17
  <properties>
17
18
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18
- <hadoop.version>2.0.0-<%= profiles['cdh4.3'] %></hadoop.version>
19
- <hbase.version>0.94.6-<%= profiles['cdh4.3'] %></hbase.version>
19
+ <hadoop.version>2.0.0-<%= profiles[cdh] %></hadoop.version>
20
+ <hbase.version>0.94.6-<%= profiles[cdh] %></hbase.version>
20
21
  </properties>
21
22
  <repositories>
22
23
  <repository>
@@ -47,6 +48,7 @@
47
48
  </dependency>
48
49
  </dependencies>
49
50
  </profile>
51
+ <% end %>
50
52
 
51
53
  <profile>
52
54
  <id>cdh4.2</id>
@@ -129,7 +131,6 @@
129
131
  <hbase.version>0.90.6-<%= profiles['cdh3'] %></hbase.version>
130
132
  <hadoop.version>0.20.2-<%= profiles['cdh3'] %></hadoop.version>
131
133
  </properties>
132
-
133
134
  <repositories>
134
135
  <repository>
135
136
  <id>cloudera-releases</id>
@@ -153,7 +154,38 @@
153
154
  </dependencies>
154
155
  </profile>
155
156
 
156
- <% %w[0.92 0.94 0.95].each do |version| %>
157
+ <% %w[0.95 0.96].each do |version| %>
158
+ <profile>
159
+ <id><%= version %></id>
160
+ <properties>
161
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
162
+ <hbase.version><%= profiles[version] %></hbase.version>
163
+ </properties>
164
+
165
+ <dependencies>
166
+ <dependency>
167
+ <groupId>org.apache.hadoop</groupId>
168
+ <% if profiles[version] =~ /hadoop2/ %>
169
+ <artifactId>hadoop-common</artifactId>
170
+ <version>2.2.0</version>
171
+ <% else %>
172
+ <artifactId>hadoop-core</artifactId>
173
+ <version>1.1.2</version>
174
+ <% end %>
175
+ <scope>compile</scope>
176
+ </dependency>
177
+
178
+ <dependency>
179
+ <groupId>org.apache.hbase</groupId>
180
+ <artifactId>hbase</artifactId>
181
+ <version>${hbase.version}</version>
182
+ <scope>compile</scope>
183
+ </dependency>
184
+ </dependencies>
185
+ </profile>
186
+ <% end %>
187
+
188
+ <% %w[0.92 0.94].each do |version| %>
157
189
  <profile>
158
190
  <id><%= version %></id>
159
191
  <properties>
@@ -43,9 +43,10 @@ class Row
43
43
  def to_h
44
44
  HASH_TEMPLATE.clone.tap do |ret|
45
45
  @result.getNoVersionMap.each do |cf, cqmap|
46
- cf = cf.to_s
46
+ cf = Util.from_bytes :string, cf
47
47
  cqmap.each do |cq, val|
48
- f, q, t = @table.lookup_schema(cq.to_s)
48
+ cqs = Util.from_bytes(:string, cq) rescue nil
49
+ f, q, t = @table.lookup_schema(cqs)
49
50
  t = nil if f != cf
50
51
  name = t ? q : [cf.to_sym, ByteArray[cq]]
51
52
 
@@ -60,9 +61,10 @@ class Row
60
61
  def to_H
61
62
  HASH_TEMPLATE.clone.tap do |ret|
62
63
  @result.getMap.each do |cf, cqmap|
63
- cf = cf.to_s
64
+ cf = Util.from_bytes :string, cf
64
65
  cqmap.each do |cq, tsmap|
65
- f, q, t = @table.lookup_schema(cq.to_s)
66
+ cqs = Util.from_bytes(:string, cq) rescue nil
67
+ f, q, t = @table.lookup_schema(cqs)
66
68
  t = nil if f != cf
67
69
  name = t ? q : [cf.to_sym, ByteArray[cq]]
68
70
 
@@ -77,10 +77,16 @@ class Schema
77
77
  def lookup table, col
78
78
  return nil unless lookup = @lookup[table]
79
79
 
80
- if match = lookup[:exact][col]
81
- return match
82
- elsif pair = lookup[:pattern].find { |k, v| col.to_s =~ k }
83
- return pair[1].dup.tap { |e| e[1] = col.to_sym }
80
+ case col
81
+ when String, Symbol
82
+ if match = lookup[:exact][col]
83
+ return match
84
+ elsif pair = lookup[:pattern].find { |k, v| col.to_s =~ k }
85
+ colsym = col.to_sym rescue nil
86
+ return colsym && pair[1].dup.tap { |e| e[1] = colsym }
87
+ end
88
+ else
89
+ return nil
84
90
  end
85
91
  end
86
92
 
@@ -1,5 +1,5 @@
1
1
  class HBase
2
2
  module JRuby
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
data/test/test_schema.rb CHANGED
@@ -410,5 +410,19 @@ class TestSchema < TestHBaseJRubyBase
410
410
  assert_equal true, HBase::Util.java_bytes?(@table.get(rk)['cf1:a'])
411
411
  assert_equal 100, HBase::Util.from_bytes(:fixnum, @table.get(rk)['cf1:a'])
412
412
  end
413
+
414
+ def test_schema_bytearray
415
+ # Does not support non-string/symbol qualifiers
416
+ @hbase.schema[@table.name] = {
417
+ :cf1 => {
418
+ /.*/ => :fixnum
419
+ }
420
+ }
421
+
422
+ rk = next_rowkey
423
+ @table.put rk, [:cf1, HBase::ByteArray[1234]] => 1234
424
+
425
+ assert_equal HBase::ByteArray[1234], HBase::ByteArray[@table.get(rk)[[:cf1, HBase::ByteArray[1234]]]]
426
+ end
413
427
  end
414
428
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hbase-jruby
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.4.1
4
+ version: 0.4.2
6
5
  platform: java
7
6
  authors:
8
7
  - Junegunn Choi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: test-unit
@@ -18,13 +17,11 @@ dependencies:
18
17
  - - '>='
19
18
  - !ruby/object:Gem::Version
20
19
  version: '0'
21
- none: false
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - '>='
25
23
  - !ruby/object:Gem::Version
26
24
  version: '0'
27
- none: false
28
25
  prerelease: false
29
26
  type: :development
30
27
  - !ruby/object:Gem::Dependency
@@ -34,13 +31,11 @@ dependencies:
34
31
  - - '>='
35
32
  - !ruby/object:Gem::Version
36
33
  version: '0'
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
36
  - - '>='
41
37
  - !ruby/object:Gem::Version
42
38
  version: '0'
43
- none: false
44
39
  prerelease: false
45
40
  type: :development
46
41
  description: A JRuby binding for HBase
@@ -90,6 +85,7 @@ files:
90
85
  homepage: https://github.com/junegunn/hbase-jruby
91
86
  licenses:
92
87
  - MIT
88
+ metadata: {}
93
89
  post_install_message:
94
90
  rdoc_options: []
95
91
  require_paths:
@@ -99,18 +95,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
95
  - - '>='
100
96
  - !ruby/object:Gem::Version
101
97
  version: '0'
102
- none: false
103
98
  required_rubygems_version: !ruby/object:Gem::Requirement
104
99
  requirements:
105
100
  - - '>='
106
101
  - !ruby/object:Gem::Version
107
102
  version: '0'
108
- none: false
109
103
  requirements: []
110
104
  rubyforge_project:
111
- rubygems_version: 1.8.24
105
+ rubygems_version: 2.2.0
112
106
  signing_key:
113
- specification_version: 3
107
+ specification_version: 4
114
108
  summary: A JRuby binding for HBase
115
109
  test_files:
116
110
  - test/helper.rb