red-arrow 0.8.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +14 -11
  3. data/{doc/text/apache-2.0.txt → LICENSE.txt} +0 -0
  4. data/NOTICE.txt +2 -0
  5. data/README.md +27 -30
  6. data/Rakefile +15 -21
  7. data/dependency-check/Rakefile +15 -12
  8. data/doc/text/development.md +19 -0
  9. data/lib/arrow.rb +14 -11
  10. data/lib/arrow/array-builder.rb +55 -55
  11. data/lib/arrow/array.rb +15 -11
  12. data/lib/arrow/block-closable.rb +14 -11
  13. data/lib/arrow/chunked-array.rb +15 -11
  14. data/lib/arrow/column.rb +14 -11
  15. data/lib/arrow/csv-loader.rb +49 -20
  16. data/lib/arrow/csv-reader.rb +14 -11
  17. data/lib/arrow/date32-array-builder.rb +14 -11
  18. data/lib/arrow/date32-array.rb +14 -11
  19. data/lib/arrow/date64-array-builder.rb +15 -12
  20. data/lib/arrow/date64-array.rb +14 -11
  21. data/lib/arrow/field.rb +14 -11
  22. data/lib/arrow/group.rb +55 -13
  23. data/lib/arrow/loader.rb +16 -15
  24. data/lib/arrow/record-batch-file-reader.rb +14 -11
  25. data/lib/arrow/record-batch-stream-reader.rb +14 -11
  26. data/lib/arrow/record-batch.rb +14 -11
  27. data/lib/arrow/record-containable.rb +14 -11
  28. data/lib/arrow/record.rb +14 -11
  29. data/lib/arrow/rolling-window.rb +48 -0
  30. data/lib/arrow/slicer.rb +20 -14
  31. data/lib/arrow/struct-array.rb +24 -0
  32. data/lib/arrow/table-formatter.rb +15 -11
  33. data/lib/arrow/table-list-formatter.rb +15 -11
  34. data/lib/arrow/table-loader.rb +24 -11
  35. data/lib/arrow/table-saver.rb +14 -11
  36. data/lib/arrow/table-table-formatter.rb +15 -11
  37. data/lib/arrow/table.rb +48 -17
  38. data/lib/arrow/tensor.rb +14 -11
  39. data/lib/arrow/timestamp-array-builder.rb +16 -29
  40. data/lib/arrow/timestamp-array.rb +15 -30
  41. data/lib/arrow/version.rb +23 -12
  42. data/red-arrow.gemspec +30 -30
  43. data/test/fixture/TestOrcFile.test1.orc +0 -0
  44. data/test/fixture/float-integer.csv +20 -0
  45. data/test/fixture/integer-float.csv +20 -0
  46. data/test/fixture/null-with-double-quote.csv +16 -0
  47. data/test/fixture/null-without-double-quote.csv +16 -0
  48. data/test/fixture/with-header-float.csv +20 -0
  49. data/test/fixture/with-header.csv +16 -0
  50. data/test/fixture/without-header-float.csv +19 -0
  51. data/test/fixture/without-header.csv +16 -0
  52. data/test/helper.rb +16 -11
  53. data/test/helper/fixture.rb +14 -11
  54. data/test/run-test.rb +17 -12
  55. data/test/test-array-builder.rb +14 -11
  56. data/test/test-array.rb +14 -11
  57. data/test/test-chunked-array.rb +14 -11
  58. data/test/test-column.rb +14 -11
  59. data/test/test-csv-loader.rb +68 -49
  60. data/test/test-csv-reader.rb +17 -12
  61. data/test/test-date32-array.rb +14 -11
  62. data/test/test-date64-array.rb +14 -11
  63. data/test/test-group.rb +56 -11
  64. data/test/test-orc.rb +177 -0
  65. data/test/test-record-batch-file-reader.rb +14 -11
  66. data/test/test-record-batch.rb +14 -11
  67. data/test/test-rolling-window.rb +40 -0
  68. data/test/test-slicer.rb +14 -11
  69. data/test/test-struct-array.rb +36 -0
  70. data/test/test-table.rb +50 -22
  71. data/test/test-timestamp-array.rb +14 -11
  72. metadata +42 -57
  73. data/.yardopts +0 -6
  74. data/doc/text/news.md +0 -176
  75. data/lib/arrow/buffer.rb +0 -24
  76. data/lib/arrow/compatibility.rb +0 -28
  77. data/lib/arrow/data-type.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d5c8c88ef78b27019b54dca4de8c914f17b80d9e
4
- data.tar.gz: 85a527d72ea710c9f4c55e4c2db36110693a9f2c
2
+ SHA256:
3
+ metadata.gz: e7ad82aea6e936a77e584a46b230a543f6f790a0e340e8587e82db6c17a07161
4
+ data.tar.gz: 78500925eb85fc529e3293e3690a3a5aaf19d4208354729174e09b1adfa45988
5
5
  SHA512:
6
- metadata.gz: 7b4635c2517a7b750c7f46341bd659504e4d2cbbba6f1d2ef4f32c47c1870de891a7bf009fcd4783284f72b515eaeb2e4846121bf0b66e8eeb017d9ab5f1727c
7
- data.tar.gz: 21a10ffe298a91ec56b5354bcc6693348fdb815db04861fc04124849b111ffadc5ddbac2582cf6d87d8f96ec2060179fb2e19866f8f7be2699d547a2e2d861dc
6
+ metadata.gz: 5947773a60fe43c92451aa53451212cc3dd3c1fb0f29206fcf0e39c5ca8f83a42314970a42c96dbbdef2d34635f5b0cb89edf6b208b4d0de72079a4628ef9179
7
+ data.tar.gz: 660eaaf51764cfe5f2d05616ea1b6db77a9fb293f1716cfbaa0e7cf1d812a8d98381740ea378ebc222f1524fb7c18bebcc187c808de4b45244121e1675119a02
data/Gemfile CHANGED
@@ -1,18 +1,21 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
4
10
  #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
11
+ # http://www.apache.org/licenses/LICENSE-2.0
8
12
  #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
16
19
 
17
20
  source "https://rubygems.org/"
18
21
 
File without changes
@@ -0,0 +1,2 @@
1
+ Apache Arrow
2
+ Copyright 2016 The Apache Software Foundation
data/README.md CHANGED
@@ -1,28 +1,43 @@
1
- # README
1
+ <!---
2
+ Licensed to the Apache Software Foundation (ASF) under one
3
+ or more contributor license agreements. See the NOTICE file
4
+ distributed with this work for additional information
5
+ regarding copyright ownership. The ASF licenses this file
6
+ to you under the Apache License, Version 2.0 (the
7
+ "License"); you may not use this file except in compliance
8
+ with the License. You may obtain a copy of the License at
2
9
 
3
- ## Name
10
+ http://www.apache.org/licenses/LICENSE-2.0
4
11
 
5
- Red Arrow
12
+ Unless required by applicable law or agreed to in writing,
13
+ software distributed under the License is distributed on an
14
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ KIND, either express or implied. See the License for the
16
+ specific language governing permissions and limitations
17
+ under the License.
18
+ -->
6
19
 
7
- ## Description
20
+ # Red Arrow - Apache Arrow Ruby
8
21
 
9
- Red Arrow is a Ruby bindings of Apache Arrow. Red Arrow is based on GObject Introspection.
22
+ Red Arrow is the Ruby bindings of Apache Arrow. Red Arrow is based on GObject Introspection.
10
23
 
11
24
  [Apache Arrow](https://arrow.apache.org/) is an in-memory columnar data store. It's used by many products for data analytics.
12
25
 
13
26
  [GObject Introspection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection) is a middleware for language bindings of C library. GObject Introspection can generate language bindings automatically at runtime.
14
27
 
15
- Red Arrow uses [Arrow GLib](https://github.com/apache/arrow/tree/master/c_glib) and [gobject-introspection gem](https://rubygems.org/gems/gobject-introspection) to generate Ruby bindings of Apache Arrow.
28
+ Red Arrow uses [Apache Arrow GLib](https://github.com/apache/arrow/tree/master/c_glib) and [gobject-introspection gem](https://rubygems.org/gems/gobject-introspection) to generate Ruby bindings of Apache Arrow.
16
29
 
17
- Arrow GLib is a C wrapper for [Arrow C++](https://github.com/apache/arrow/tree/master/cpp). GObject Introspection can't use Arrow C++ directly. Arrow GLib is a bridge between Arrow C++ and GObject Introspection.
30
+ Apache Arrow GLib is a C wrapper for [Apache Arrow C++](https://github.com/apache/arrow/tree/master/cpp). GObject Introspection can't use Apache Arrow C++ directly. Apache Arrow GLib is a bridge between Apache Arrow C++ and GObject Introspection.
18
31
 
19
32
  gobject-introspection gem is a Ruby bindings of GObject Introspection. Red Arrow uses GObject Introspection via gobject-introspection gem.
20
33
 
21
34
  ## Install
22
35
 
23
- Install Arrow GLib before install Red Arrow. Use [packages.red-data-tools.org](https://github.com/red-data-tools/packages.red-data-tools.org) for installing Arrow GLib.
36
+ Install Apache Arrow GLib before install Red Arrow. Use [packages.red-data-tools.org](https://github.com/red-data-tools/packages.red-data-tools.org) for installing Apache Arrow GLib.
24
37
 
25
- Install Red Arrow after you install Arrow GLib:
38
+ Note that the Apache Arrow GLib packages are "unofficial". "Official" packages will be released in the future.
39
+
40
+ Install Red Arrow after you install Apache Arrow GLib:
26
41
 
27
42
  ```text
28
43
  % gem install red-arrow
@@ -33,25 +48,7 @@ Install Red Arrow after you install Arrow GLib:
33
48
  ```ruby
34
49
  require "arrow"
35
50
 
36
- # TODO
51
+ table = Arrow::Table.load("/dev/shm/data.arrow")
52
+ # Process data in table
53
+ table.save("/dev/shm/data-processed.arrow")
37
54
  ```
38
-
39
- ## Dependencies
40
-
41
- * [Apache Arrow](https://arrow.apache.org/)
42
-
43
- * [Arrow GLib](https://github.com/apache/arrow/tree/master/c_glib)
44
-
45
- * [gobject-introspection gem](https://rubygems.org/gems/gobject-introspection)
46
-
47
- ## Authors
48
-
49
- * Kouhei Sutou \<kou@clear-code.com\>
50
-
51
- ## License
52
-
53
- Apache License 2.0. See `doc/text/apache-2.0.txt` and `NOTICE` for
54
- details.
55
-
56
- (Kouhei Sutou has a right to change the license including contributed
57
- patches.)
data/Rakefile CHANGED
@@ -1,24 +1,26 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
4
10
  #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
11
+ # http://www.apache.org/licenses/LICENSE-2.0
8
12
  #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
16
19
 
17
20
  require "rubygems"
18
21
  require "bundler/gem_helper"
19
- require "packnga"
20
22
 
21
- base_dir = File.join(File.dirname(__FILE__))
23
+ base_dir = File.join(__dir__)
22
24
 
23
25
  helper = Bundler::GemHelper.new(base_dir)
24
26
  def helper.version_tag
@@ -28,14 +30,6 @@ end
28
30
  helper.install
29
31
  spec = helper.gemspec
30
32
 
31
- Packnga::DocumentTask.new(spec) do |task|
32
- task.original_language = "en"
33
- task.translate_language = "ja"
34
- end
35
-
36
- Packnga::ReleaseTask.new(spec) do
37
- end
38
-
39
33
  desc "Run tests"
40
34
  task :test do
41
35
  cd("dependency-check") do
@@ -1,18 +1,21 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
4
10
  #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
11
+ # http://www.apache.org/licenses/LICENSE-2.0
8
12
  #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
16
19
 
17
20
  require "pkg-config"
18
21
  require "native-package-installer"
@@ -30,7 +33,7 @@ end
30
33
  namespace :dependency do
31
34
  desc "Check dependency"
32
35
  task :check do
33
- unless PKGConfig.check_version?("arrow-glib", 0, 8, 0)
36
+ unless PKGConfig.check_version?("arrow-glib", 0, 9, 0)
34
37
  unless NativePackageInstaller.install(:debian => "libarrow-glib-dev",
35
38
  :redhat => "arrow-glib-devel")
36
39
  exit(false)
@@ -1,3 +1,22 @@
1
+ <!---
2
+ Licensed to the Apache Software Foundation (ASF) under one
3
+ or more contributor license agreements. See the NOTICE file
4
+ distributed with this work for additional information
5
+ regarding copyright ownership. The ASF licenses this file
6
+ to you under the Apache License, Version 2.0 (the
7
+ "License"); you may not use this file except in compliance
8
+ with the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing,
13
+ software distributed under the License is distributed on an
14
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ KIND, either express or implied. See the License for the
16
+ specific language governing permissions and limitations
17
+ under the License.
18
+ -->
19
+
1
20
  # Development
2
21
 
3
22
  ## Naming convention
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
2
8
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
9
+ # http://www.apache.org/licenses/LICENSE-2.0
6
10
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
14
17
 
15
18
  require "gobject-introspection"
16
19
 
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
2
8
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
9
+ # http://www.apache.org/licenses/LICENSE-2.0
6
10
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
14
17
 
15
18
  require "date"
16
19
 
@@ -35,7 +38,7 @@ module Arrow
35
38
  when Float
36
39
  return DoubleArray.new(values)
37
40
  when Integer
38
- if value.negative?
41
+ if value < 0
39
42
  builder = IntArrayBuilder.new
40
43
  return builder.build(values)
41
44
  else
@@ -63,62 +66,59 @@ module Arrow
63
66
 
64
67
  def build(values)
65
68
  value_convertable = respond_to?(:convert_to_arrow_value, true)
66
- if respond_to?(:append_values)
67
- start_index = 0
68
- current_index = 0
69
- status = :value
70
- values.each do |value|
71
- if value.nil?
72
- if status == :value
73
- if start_index != current_index
74
- target_values = values[start_index...current_index]
75
- if value_convertable
76
- target_values = target_values.collect do |v|
77
- convert_to_arrow_value(v)
78
- end
69
+ start_index = 0
70
+ current_index = 0
71
+ status = :value
72
+
73
+ values.each do |value|
74
+ if value.nil?
75
+ if status == :value
76
+ if start_index != current_index
77
+ target_values = values[start_index...current_index]
78
+ if value_convertable
79
+ target_values = target_values.collect do |v|
80
+ convert_to_arrow_value(v)
79
81
  end
80
- append_values(target_values)
81
- start_index = current_index
82
82
  end
83
- status = :null
84
- end
85
- else
86
- if status == :null
87
- append_nulls(current_index - start_index)
83
+ append_values(target_values, nil)
88
84
  start_index = current_index
89
- status = :value
90
85
  end
86
+ status = :null
91
87
  end
92
- current_index += 1
93
- end
94
- if start_index != current_index
95
- if status == :value
96
- if start_index == 0 and current_index == values.size
97
- target_values = values
98
- else
99
- target_values = values[start_index...current_index]
100
- end
101
- if value_convertable
102
- target_values = target_values.collect do |v|
103
- convert_to_arrow_value(v)
104
- end
105
- end
106
- append_values(target_values)
107
- else
88
+ else
89
+ if status == :null
108
90
  append_nulls(current_index - start_index)
91
+ start_index = current_index
92
+ status = :value
109
93
  end
110
94
  end
111
- else
112
- values.each do |value|
113
- if value.nil?
114
- append_null
95
+ current_index += 1
96
+ end
97
+ if start_index != current_index
98
+ if status == :value
99
+ if start_index == 0 and current_index == values.size
100
+ target_values = values
115
101
  else
116
- value = convert_to_arrow_value(value) if value_convertable
117
- append(value)
102
+ target_values = values[start_index...current_index]
103
+ end
104
+ if value_convertable
105
+ target_values = target_values.collect do |v|
106
+ convert_to_arrow_value(v)
107
+ end
118
108
  end
109
+ append_values(target_values, nil)
110
+ else
111
+ append_nulls(current_index - start_index)
119
112
  end
120
113
  end
114
+
121
115
  finish
122
116
  end
117
+
118
+ def append_nulls(n)
119
+ n.times do
120
+ append_null
121
+ end
122
+ end
123
123
  end
124
124
  end
@@ -1,16 +1,19 @@
1
- # Copyright 2017-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
2
8
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
9
+ # http://www.apache.org/licenses/LICENSE-2.0
6
10
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
14
17
 
15
18
  module Arrow
16
19
  class Array
@@ -29,6 +32,7 @@ module Arrow
29
32
  end
30
33
 
31
34
  def [](i)
35
+ i += length if i < 0
32
36
  if null?(i)
33
37
  nil
34
38
  else