red-arrow 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependency-check/Rakefile +40 -0
- data/doc/text/news.md +29 -0
- data/lib/arrow/array.rb +5 -1
- data/lib/arrow/chunked-array.rb +28 -0
- data/lib/arrow/column.rb +25 -0
- data/lib/arrow/loader.rb +5 -2
- data/lib/arrow/{file-reader.rb → record-batch-file-reader.rb} +1 -29
- data/lib/arrow/{stream-reader.rb → record-batch-stream-reader.rb} +1 -1
- data/lib/arrow/table.rb +29 -0
- data/lib/arrow/version.rb +1 -1
- data/red-arrow.gemspec +3 -0
- data/test/test-array.rb +6 -0
- data/test/test-chunked-array.rb +25 -0
- data/test/test-column.rb +27 -0
- data/test/{test-file-reader.rb → test-record-batch-file-reader.rb} +3 -3
- data/test/test-table.rb +32 -0
- metadata +46 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77e27ff86072c96cce811ad70a0657630899f7c9
|
4
|
+
data.tar.gz: 33fe984ad9e639d3fb98e9733da997c39da6bf65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c2a4829076698810d9ce2837e238d0ad673d70ed1487fd116ce836713a99278aab0136a08b2824f1d6bc7e652c94b972d7a97ccfc5d22821ad61d8d5ae45332
|
7
|
+
data.tar.gz: c374346921b53f397c58c03eb0f025aba425529f9ff6422eb397ea97170aeddd3b45692e9b16e9ec0df1ea211c98b9fa54119e207e9a5a099c7a0f7d787d4af9
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
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
|
8
|
+
#
|
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.
|
16
|
+
|
17
|
+
require "pkg-config"
|
18
|
+
require "native-package-installer"
|
19
|
+
|
20
|
+
case RUBY_PLATFORM
|
21
|
+
when /mingw|mswin/
|
22
|
+
task :default => "nothing"
|
23
|
+
else
|
24
|
+
task :default => "dependency:check"
|
25
|
+
end
|
26
|
+
|
27
|
+
task :nothing do
|
28
|
+
end
|
29
|
+
|
30
|
+
namespace :dependency do
|
31
|
+
desc "Check dependency"
|
32
|
+
task :check do
|
33
|
+
unless PKGConfig.check_version?("arrow-glib")
|
34
|
+
unless NativePackageInstaller.install(:debian => "libarrow-glib-dev",
|
35
|
+
:redhat => "arrow-glib-devel")
|
36
|
+
exit(false)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 0.3.1 - 2017-05-17
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* `Arrow::MemoryMappedInputStream`: Renamed from
|
8
|
+
`Arrow::MemoryMappedFile`.
|
9
|
+
|
10
|
+
* `Arrow::RecordBatchStreamReader`: Renamed from
|
11
|
+
`Arrow::StreamReader`.
|
12
|
+
|
13
|
+
* `Arrow::RecordBatchFileReader`: Renamed from
|
14
|
+
`Arrow::FileReader`.
|
15
|
+
|
16
|
+
* `Arrow::RecordBatchStreamWriter`: Renamed from
|
17
|
+
`Arrow::StreamWriter`.
|
18
|
+
|
19
|
+
* `Arrow::RecordBatchFileWriter`: Renamed from
|
20
|
+
`Arrow::FileWriter`.
|
21
|
+
|
22
|
+
* `Arrow::Column#each`: Added.
|
23
|
+
|
24
|
+
* `Arrow::ChunkedColumn#each`: Added.
|
25
|
+
|
26
|
+
* `Arrow::Table#columns`: Added.
|
27
|
+
|
28
|
+
* `Arrow::Table#each_column`: Added.
|
29
|
+
|
30
|
+
* Supported auto native package install on install.
|
31
|
+
|
3
32
|
## 0.3.0 - 2017-05-06
|
4
33
|
|
5
34
|
### Improvements
|
data/lib/arrow/array.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
module Arrow
|
16
|
+
class ChunkedArray
|
17
|
+
include Enumerable
|
18
|
+
|
19
|
+
def each(&block)
|
20
|
+
return to_enum(__method__) unless block_given?
|
21
|
+
|
22
|
+
n_chunks.times do |i|
|
23
|
+
array = get_chunk(i)
|
24
|
+
array.each(&block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/arrow/column.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
module Arrow
|
16
|
+
class Column
|
17
|
+
include Enumerable
|
18
|
+
|
19
|
+
def each(&block)
|
20
|
+
return to_enum(__method__) unless block_given?
|
21
|
+
|
22
|
+
data.each(&block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/arrow/loader.rb
CHANGED
@@ -30,12 +30,15 @@ module Arrow
|
|
30
30
|
def require_libraries
|
31
31
|
require "arrow/array"
|
32
32
|
require "arrow/array-builder"
|
33
|
+
require "arrow/chunked-array"
|
34
|
+
require "arrow/column"
|
33
35
|
require "arrow/field"
|
34
36
|
require "arrow/record-batch"
|
37
|
+
require "arrow/table"
|
35
38
|
require "arrow/tensor"
|
36
39
|
|
37
|
-
require "arrow/file-reader"
|
38
|
-
require "arrow/stream-reader"
|
40
|
+
require "arrow/record-batch-file-reader"
|
41
|
+
require "arrow/record-batch-stream-reader"
|
39
42
|
|
40
43
|
require "arrow/compatibility"
|
41
44
|
end
|
@@ -13,37 +13,9 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
module Arrow
|
16
|
-
class
|
16
|
+
class RecordBatchFileReader
|
17
17
|
include Enumerable
|
18
18
|
|
19
|
-
# For backward compatibility
|
20
|
-
if respond_to?(:open)
|
21
|
-
class << self
|
22
|
-
alias_method :open_raw, :open
|
23
|
-
def open(input)
|
24
|
-
warn("#{self}.#{__method__}: use #{self}.new instead: #{caller(1, 1)[0]}")
|
25
|
-
reader = open_raw(input)
|
26
|
-
if block_given?
|
27
|
-
yield(reader)
|
28
|
-
else
|
29
|
-
reader
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
else
|
34
|
-
class << self
|
35
|
-
def open(input)
|
36
|
-
warn("#{self}.#{__method__}: use #{self}.new instead #{caller(1, 1)[0]}")
|
37
|
-
reader = new(input)
|
38
|
-
if block_given?
|
39
|
-
yield(reader)
|
40
|
-
else
|
41
|
-
reader
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
19
|
def each
|
48
20
|
n_record_batches.times do |i|
|
49
21
|
yield(get_record_batch(i))
|
data/lib/arrow/table.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
module Arrow
|
16
|
+
class Table
|
17
|
+
def each_column(&block)
|
18
|
+
return to_enum(__method__) unless block_given?
|
19
|
+
|
20
|
+
n_columns.times do |i|
|
21
|
+
yield(get_column(i))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def columns
|
26
|
+
each_column.to_a
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/arrow/version.rb
CHANGED
data/red-arrow.gemspec
CHANGED
@@ -40,8 +40,11 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.files += Dir.glob("lib/**/*.rb")
|
41
41
|
spec.files += Dir.glob("doc/text/*")
|
42
42
|
spec.test_files += Dir.glob("test/**/*")
|
43
|
+
spec.extensions = ["dependency-check/Rakefile"]
|
43
44
|
|
44
45
|
spec.add_runtime_dependency("gobject-introspection", ">= 3.1.1")
|
46
|
+
spec.add_runtime_dependency("pkg-config")
|
47
|
+
spec.add_runtime_dependency("native-package-installer")
|
45
48
|
|
46
49
|
spec.add_development_dependency("bundler")
|
47
50
|
spec.add_development_dependency("rake")
|
data/test/test-array.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
class ChunkedArrayTest < Test::Unit::TestCase
|
16
|
+
test("#each") do
|
17
|
+
arrayes = [
|
18
|
+
Arrow::BooleanArray.new([true, false]),
|
19
|
+
Arrow::BooleanArray.new([nil, true]),
|
20
|
+
]
|
21
|
+
chunked_array = Arrow::ChunkedArray.new(arrayes)
|
22
|
+
assert_equal([true, false, nil, true],
|
23
|
+
chunked_array.to_a)
|
24
|
+
end
|
25
|
+
end
|
data/test/test-column.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
class ColumnTest < Test::Unit::TestCase
|
16
|
+
test("#each") do
|
17
|
+
arrayes = [
|
18
|
+
Arrow::BooleanArray.new([true, false]),
|
19
|
+
Arrow::BooleanArray.new([nil, true]),
|
20
|
+
]
|
21
|
+
chunked_array = Arrow::ChunkedArray.new(arrayes)
|
22
|
+
column = Arrow::Column.new(Arrow::Field.new("visible", :boolean),
|
23
|
+
chunked_array)
|
24
|
+
assert_equal([true, false, nil, true],
|
25
|
+
column.to_a)
|
26
|
+
end
|
27
|
+
end
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
class
|
15
|
+
class RecordBatchFileReaderTest < Test::Unit::TestCase
|
16
16
|
test("write/read") do
|
17
17
|
fields = [
|
18
18
|
Arrow::Field.new("uint8", :uint8),
|
@@ -30,7 +30,7 @@ class FileReaderTest < Test::Unit::TestCase
|
|
30
30
|
|
31
31
|
tempfile = Tempfile.new(["batch", ".arrow"])
|
32
32
|
Arrow::FileOutputStream.open(tempfile.path, false) do |output|
|
33
|
-
Arrow::
|
33
|
+
Arrow::RecordBatchFileWriter.open(output, schema) do |writer|
|
34
34
|
uints = [1, 2, 4, 8]
|
35
35
|
ints = [1, -2, 4, -8]
|
36
36
|
floats = [1.1, -2.2, 4.4, -8.8]
|
@@ -53,7 +53,7 @@ class FileReaderTest < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
|
55
55
|
Arrow::MemoryMappedInputStream.open(tempfile.path) do |input|
|
56
|
-
reader = Arrow::
|
56
|
+
reader = Arrow::RecordBatchFileReader.new(input)
|
57
57
|
reader.each do |record_batch|
|
58
58
|
assert_equal([
|
59
59
|
{
|
data/test/test-table.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
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
|
6
|
+
#
|
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.
|
14
|
+
|
15
|
+
class TableTest < Test::Unit::TestCase
|
16
|
+
test("#columns") do
|
17
|
+
fields = [
|
18
|
+
Arrow::Field.new("count", :uint32),
|
19
|
+
Arrow::Field.new("visible", :boolean),
|
20
|
+
]
|
21
|
+
schema = Arrow::Schema.new(fields)
|
22
|
+
columns = [
|
23
|
+
Arrow::Column.new(fields[0],
|
24
|
+
Arrow::UInt32Array.new([1, 2, 4, 8])),
|
25
|
+
Arrow::Column.new(fields[1],
|
26
|
+
Arrow::BooleanArray.new([true, false, nil, true])),
|
27
|
+
]
|
28
|
+
table = Arrow::Table.new(schema, columns)
|
29
|
+
assert_equal(["count", "visible"],
|
30
|
+
table.columns.collect(&:name))
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red-arrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gobject-introspection
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.1.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pkg-config
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: native-package-installer
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: bundler
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,34 +127,42 @@ description: "[Apache Arrow](https://arrow.apache.org/) is an in-memory columnar
|
|
99
127
|
email:
|
100
128
|
- kou@clear-code.com
|
101
129
|
executables: []
|
102
|
-
extensions:
|
130
|
+
extensions:
|
131
|
+
- dependency-check/Rakefile
|
103
132
|
extra_rdoc_files: []
|
104
133
|
files:
|
105
134
|
- ".yardopts"
|
106
135
|
- Gemfile
|
107
136
|
- README.md
|
108
137
|
- Rakefile
|
138
|
+
- dependency-check/Rakefile
|
109
139
|
- doc/text/apache-2.0.txt
|
110
140
|
- doc/text/news.md
|
111
141
|
- lib/arrow.rb
|
112
142
|
- lib/arrow/array-builder.rb
|
113
143
|
- lib/arrow/array.rb
|
114
144
|
- lib/arrow/block-closable.rb
|
145
|
+
- lib/arrow/chunked-array.rb
|
146
|
+
- lib/arrow/column.rb
|
115
147
|
- lib/arrow/compatibility.rb
|
116
148
|
- lib/arrow/field.rb
|
117
|
-
- lib/arrow/file-reader.rb
|
118
149
|
- lib/arrow/loader.rb
|
150
|
+
- lib/arrow/record-batch-file-reader.rb
|
151
|
+
- lib/arrow/record-batch-stream-reader.rb
|
119
152
|
- lib/arrow/record-batch.rb
|
120
153
|
- lib/arrow/record.rb
|
121
|
-
- lib/arrow/
|
154
|
+
- lib/arrow/table.rb
|
122
155
|
- lib/arrow/tensor.rb
|
123
156
|
- lib/arrow/version.rb
|
124
157
|
- red-arrow.gemspec
|
125
158
|
- test/helper.rb
|
126
159
|
- test/run-test.rb
|
127
160
|
- test/test-array.rb
|
128
|
-
- test/test-
|
161
|
+
- test/test-chunked-array.rb
|
162
|
+
- test/test-column.rb
|
163
|
+
- test/test-record-batch-file-reader.rb
|
129
164
|
- test/test-record-batch.rb
|
165
|
+
- test/test-table.rb
|
130
166
|
homepage: https://github.com/red-data-tools/red-arrow
|
131
167
|
licenses:
|
132
168
|
- Apache-2.0
|
@@ -153,8 +189,11 @@ specification_version: 4
|
|
153
189
|
summary: Red Arrow is a Ruby bindings of Apache Arrow. Red Arrow is based on GObject
|
154
190
|
Introspection.
|
155
191
|
test_files:
|
192
|
+
- test/test-record-batch-file-reader.rb
|
193
|
+
- test/test-column.rb
|
194
|
+
- test/test-chunked-array.rb
|
156
195
|
- test/test-record-batch.rb
|
157
196
|
- test/helper.rb
|
158
197
|
- test/run-test.rb
|
198
|
+
- test/test-table.rb
|
159
199
|
- test/test-array.rb
|
160
|
-
- test/test-file-reader.rb
|