red-arrow 0.8.2 → 0.10.0
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.
- checksums.yaml +5 -5
- data/Gemfile +14 -11
- data/{doc/text/apache-2.0.txt → LICENSE.txt} +0 -0
- data/NOTICE.txt +2 -0
- data/README.md +27 -30
- data/Rakefile +15 -21
- data/dependency-check/Rakefile +15 -12
- data/doc/text/development.md +19 -0
- data/lib/arrow.rb +14 -11
- data/lib/arrow/array-builder.rb +55 -55
- data/lib/arrow/array.rb +15 -11
- data/lib/arrow/block-closable.rb +14 -11
- data/lib/arrow/chunked-array.rb +15 -11
- data/lib/arrow/column.rb +14 -11
- data/lib/arrow/csv-loader.rb +49 -20
- data/lib/arrow/csv-reader.rb +14 -11
- data/lib/arrow/date32-array-builder.rb +14 -11
- data/lib/arrow/date32-array.rb +14 -11
- data/lib/arrow/date64-array-builder.rb +15 -12
- data/lib/arrow/date64-array.rb +14 -11
- data/lib/arrow/field.rb +14 -11
- data/lib/arrow/group.rb +55 -13
- data/lib/arrow/loader.rb +16 -15
- data/lib/arrow/record-batch-file-reader.rb +14 -11
- data/lib/arrow/record-batch-stream-reader.rb +14 -11
- data/lib/arrow/record-batch.rb +14 -11
- data/lib/arrow/record-containable.rb +14 -11
- data/lib/arrow/record.rb +14 -11
- data/lib/arrow/rolling-window.rb +48 -0
- data/lib/arrow/slicer.rb +20 -14
- data/lib/arrow/struct-array.rb +24 -0
- data/lib/arrow/table-formatter.rb +15 -11
- data/lib/arrow/table-list-formatter.rb +15 -11
- data/lib/arrow/table-loader.rb +24 -11
- data/lib/arrow/table-saver.rb +14 -11
- data/lib/arrow/table-table-formatter.rb +15 -11
- data/lib/arrow/table.rb +48 -17
- data/lib/arrow/tensor.rb +14 -11
- data/lib/arrow/timestamp-array-builder.rb +16 -29
- data/lib/arrow/timestamp-array.rb +15 -30
- data/lib/arrow/version.rb +23 -12
- data/red-arrow.gemspec +30 -30
- data/test/fixture/TestOrcFile.test1.orc +0 -0
- data/test/fixture/float-integer.csv +20 -0
- data/test/fixture/integer-float.csv +20 -0
- data/test/fixture/null-with-double-quote.csv +16 -0
- data/test/fixture/null-without-double-quote.csv +16 -0
- data/test/fixture/with-header-float.csv +20 -0
- data/test/fixture/with-header.csv +16 -0
- data/test/fixture/without-header-float.csv +19 -0
- data/test/fixture/without-header.csv +16 -0
- data/test/helper.rb +16 -11
- data/test/helper/fixture.rb +14 -11
- data/test/run-test.rb +17 -12
- data/test/test-array-builder.rb +14 -11
- data/test/test-array.rb +14 -11
- data/test/test-chunked-array.rb +14 -11
- data/test/test-column.rb +14 -11
- data/test/test-csv-loader.rb +68 -49
- data/test/test-csv-reader.rb +17 -12
- data/test/test-date32-array.rb +14 -11
- data/test/test-date64-array.rb +14 -11
- data/test/test-group.rb +56 -11
- data/test/test-orc.rb +177 -0
- data/test/test-record-batch-file-reader.rb +14 -11
- data/test/test-record-batch.rb +14 -11
- data/test/test-rolling-window.rb +40 -0
- data/test/test-slicer.rb +14 -11
- data/test/test-struct-array.rb +36 -0
- data/test/test-table.rb +50 -22
- data/test/test-timestamp-array.rb +14 -11
- metadata +42 -57
- data/.yardopts +0 -6
- data/doc/text/news.md +0 -176
- data/lib/arrow/buffer.rb +0 -24
- data/lib/arrow/compatibility.rb +0 -28
- data/lib/arrow/data-type.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e7ad82aea6e936a77e584a46b230a543f6f790a0e340e8587e82db6c17a07161
|
4
|
+
data.tar.gz: 78500925eb85fc529e3293e3690a3a5aaf19d4208354729174e09b1adfa45988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5947773a60fe43c92451aa53451212cc3dd3c1fb0f29206fcf0e39c5ca8f83a42314970a42c96dbbdef2d34635f5b0cb89edf6b208b4d0de72079a4628ef9179
|
7
|
+
data.tar.gz: 660eaaf51764cfe5f2d05616ea1b6db77a9fb293f1716cfbaa0e7cf1d812a8d98381740ea378ebc222f1524fb7c18bebcc187c808de4b45244121e1675119a02
|
data/Gemfile
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
#
|
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
|
-
#
|
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
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
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
|
data/NOTICE.txt
ADDED
data/README.md
CHANGED
@@ -1,28 +1,43 @@
|
|
1
|
-
|
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
|
-
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
4
11
|
|
5
|
-
|
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
|
-
|
20
|
+
# Red Arrow - Apache Arrow Ruby
|
8
21
|
|
9
|
-
Red Arrow is
|
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
|
-
|
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
|
-
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
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(
|
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
|
data/dependency-check/Rakefile
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
#
|
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
|
-
#
|
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
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
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,
|
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)
|
data/doc/text/development.md
CHANGED
@@ -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
|
data/lib/arrow.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
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
|
-
#
|
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
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
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
|
|
data/lib/arrow/array-builder.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
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
|
-
#
|
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
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
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
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
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
|
-
|
93
|
-
|
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
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
117
|
-
|
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
|
data/lib/arrow/array.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
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
|
-
#
|
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
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
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
|