You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by jo...@apache.org on 2021/04/18 14:40:11 UTC
[arrow-rs] 01/14: Removed Ruby.
This is an automated email from the ASF dual-hosted git repository.
jorgecarleitao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit ff4212c9a510d0493cb6609e3d8bc324b83a255a
Author: Jorge C. Leitao <jo...@gmail.com>
AuthorDate: Sun Apr 18 14:19:08 2021 +0000
Removed Ruby.
---
ruby/Gemfile | 22 -
ruby/README.md | 36 -
ruby/Rakefile | 56 --
ruby/red-arrow-cuda/.gitignore | 18 -
ruby/red-arrow-cuda/Gemfile | 24 -
ruby/red-arrow-cuda/LICENSE.txt | 202 ------
ruby/red-arrow-cuda/NOTICE.txt | 2 -
ruby/red-arrow-cuda/README.md | 60 --
ruby/red-arrow-cuda/Rakefile | 41 --
ruby/red-arrow-cuda/dependency-check/Rakefile | 47 --
ruby/red-arrow-cuda/lib/arrow-cuda.rb | 29 -
.../lib/arrow-cuda/device-manager.rb | 25 -
ruby/red-arrow-cuda/lib/arrow-cuda/loader.rb | 35 -
ruby/red-arrow-cuda/lib/arrow-cuda/version.rb | 26 -
ruby/red-arrow-cuda/red-arrow-cuda.gemspec | 51 --
ruby/red-arrow-cuda/test/helper.rb | 20 -
ruby/red-arrow-cuda/test/run-test.rb | 50 --
ruby/red-arrow-cuda/test/test-cuda.rb | 38 -
ruby/red-arrow-dataset/.gitignore | 18 -
ruby/red-arrow-dataset/Gemfile | 24 -
ruby/red-arrow-dataset/LICENSE.txt | 202 ------
ruby/red-arrow-dataset/NOTICE.txt | 2 -
ruby/red-arrow-dataset/README.md | 50 --
ruby/red-arrow-dataset/Rakefile | 41 --
ruby/red-arrow-dataset/dependency-check/Rakefile | 47 --
ruby/red-arrow-dataset/lib/arrow-dataset.rb | 29 -
.../lib/arrow-dataset/in-memory-fragment.rb | 32 -
.../lib/arrow-dataset/in-memory-scan-task.rb | 35 -
ruby/red-arrow-dataset/lib/arrow-dataset/loader.rb | 36 -
.../lib/arrow-dataset/scan-options.rb | 37 -
.../red-arrow-dataset/lib/arrow-dataset/version.rb | 26 -
ruby/red-arrow-dataset/red-arrow-dataset.gemspec | 51 --
ruby/red-arrow-dataset/test/helper.rb | 20 -
ruby/red-arrow-dataset/test/run-test.rb | 50 --
.../test/test-in-memory-scan-task.rb | 33 -
ruby/red-arrow-dataset/test/test-scan-options.rb | 36 -
ruby/red-arrow/.gitignore | 22 -
ruby/red-arrow/.yardopts | 6 -
ruby/red-arrow/Gemfile | 22 -
ruby/red-arrow/LICENSE.txt | 202 ------
ruby/red-arrow/NOTICE.txt | 2 -
ruby/red-arrow/README.md | 52 --
ruby/red-arrow/Rakefile | 100 ---
ruby/red-arrow/benchmark/raw-records/boolean.yml | 65 --
.../red-arrow/benchmark/raw-records/decimal128.yml | 68 --
.../red-arrow/benchmark/raw-records/dictionary.yml | 75 --
ruby/red-arrow/benchmark/raw-records/int64.yml | 67 --
ruby/red-arrow/benchmark/raw-records/list.yml | 70 --
ruby/red-arrow/benchmark/raw-records/string.yml | 65 --
ruby/red-arrow/benchmark/raw-records/timestamp.yml | 75 --
ruby/red-arrow/benchmark/values/boolean.yml | 37 -
ruby/red-arrow/benchmark/values/decimal128.yml | 38 -
ruby/red-arrow/benchmark/values/dictionary.yml | 46 --
ruby/red-arrow/benchmark/values/int64.yml | 37 -
ruby/red-arrow/benchmark/values/list.yml | 44 --
ruby/red-arrow/benchmark/values/string.yml | 38 -
ruby/red-arrow/benchmark/values/timestamp.yml | 49 --
ruby/red-arrow/doc/text/development.md | 34 -
ruby/red-arrow/example/read-file.rb | 36 -
ruby/red-arrow/example/read-stream.rb | 36 -
ruby/red-arrow/example/write-file.rb | 63 --
ruby/red-arrow/example/write-stream.rb | 63 --
ruby/red-arrow/ext/arrow/arrow.cpp | 81 ---
ruby/red-arrow/ext/arrow/converters.cpp | 42 --
ruby/red-arrow/ext/arrow/converters.hpp | 669 -----------------
ruby/red-arrow/ext/arrow/extconf.rb | 63 --
ruby/red-arrow/ext/arrow/raw-records.cpp | 183 -----
ruby/red-arrow/ext/arrow/red-arrow.hpp | 95 ---
ruby/red-arrow/ext/arrow/values.cpp | 156 ----
ruby/red-arrow/image/red-arrow.png | Bin 7165 -> 0 bytes
ruby/red-arrow/lib/arrow.rb | 30 -
ruby/red-arrow/lib/arrow/array-builder.rb | 209 ------
ruby/red-arrow/lib/arrow/array.rb | 222 ------
ruby/red-arrow/lib/arrow/bigdecimal-extension.rb | 28 -
ruby/red-arrow/lib/arrow/block-closable.rb | 35 -
ruby/red-arrow/lib/arrow/buffer.rb | 28 -
ruby/red-arrow/lib/arrow/chunked-array.rb | 91 ---
ruby/red-arrow/lib/arrow/column-containable.rb | 48 --
ruby/red-arrow/lib/arrow/column.rb | 76 --
ruby/red-arrow/lib/arrow/compression-type.rb | 37 -
ruby/red-arrow/lib/arrow/csv-loader.rb | 384 ----------
ruby/red-arrow/lib/arrow/csv-read-options.rb | 43 --
ruby/red-arrow/lib/arrow/data-type.rb | 198 ------
ruby/red-arrow/lib/arrow/date32-array-builder.rb | 32 -
ruby/red-arrow/lib/arrow/date32-array.rb | 30 -
ruby/red-arrow/lib/arrow/date64-array-builder.rb | 33 -
ruby/red-arrow/lib/arrow/date64-array.rb | 29 -
.../lib/arrow/decimal128-array-builder.rb | 58 --
ruby/red-arrow/lib/arrow/decimal128-array.rb | 24 -
ruby/red-arrow/lib/arrow/decimal128-data-type.rb | 71 --
ruby/red-arrow/lib/arrow/decimal128.rb | 60 --
.../lib/arrow/decimal256-array-builder.rb | 61 --
ruby/red-arrow/lib/arrow/decimal256-array.rb | 25 -
ruby/red-arrow/lib/arrow/decimal256-data-type.rb | 73 --
ruby/red-arrow/lib/arrow/decimal256.rb | 60 --
ruby/red-arrow/lib/arrow/dense-union-data-type.rb | 90 ---
ruby/red-arrow/lib/arrow/dictionary-array.rb | 24 -
ruby/red-arrow/lib/arrow/dictionary-data-type.rb | 117 ---
ruby/red-arrow/lib/arrow/field-containable.rb | 38 -
ruby/red-arrow/lib/arrow/field.rb | 118 ---
ruby/red-arrow/lib/arrow/file-output-stream.rb | 34 -
.../lib/arrow/fixed-size-binary-array-builder.rb | 38 -
.../red-arrow/lib/arrow/fixed-size-binary-array.rb | 26 -
ruby/red-arrow/lib/arrow/generic-filterable.rb | 43 --
ruby/red-arrow/lib/arrow/generic-takeable.rb | 38 -
ruby/red-arrow/lib/arrow/group.rb | 172 -----
ruby/red-arrow/lib/arrow/list-array-builder.rb | 96 ---
ruby/red-arrow/lib/arrow/list-data-type.rb | 118 ---
ruby/red-arrow/lib/arrow/loader.rb | 172 -----
ruby/red-arrow/lib/arrow/null-array-builder.rb | 26 -
ruby/red-arrow/lib/arrow/null-array.rb | 24 -
ruby/red-arrow/lib/arrow/path-extension.rb | 45 --
ruby/red-arrow/lib/arrow/raw-table-converter.rb | 47 --
ruby/red-arrow/lib/arrow/record-batch-builder.rb | 114 ---
.../lib/arrow/record-batch-file-reader.rb | 28 -
ruby/red-arrow/lib/arrow/record-batch-iterator.rb | 22 -
.../lib/arrow/record-batch-stream-reader.rb | 30 -
ruby/red-arrow/lib/arrow/record-batch.rb | 77 --
ruby/red-arrow/lib/arrow/record-containable.rb | 38 -
ruby/red-arrow/lib/arrow/record.rb | 60 --
ruby/red-arrow/lib/arrow/rolling-window.rb | 48 --
ruby/red-arrow/lib/arrow/schema.rb | 100 ---
ruby/red-arrow/lib/arrow/slicer.rb | 454 ------------
ruby/red-arrow/lib/arrow/sort-key.rb | 193 -----
ruby/red-arrow/lib/arrow/sort-options.rb | 109 ---
ruby/red-arrow/lib/arrow/sparse-union-data-type.rb | 90 ---
ruby/red-arrow/lib/arrow/struct-array-builder.rb | 146 ----
ruby/red-arrow/lib/arrow/struct-array.rb | 68 --
ruby/red-arrow/lib/arrow/struct-data-type.rb | 128 ----
ruby/red-arrow/lib/arrow/table-formatter.rb | 66 --
ruby/red-arrow/lib/arrow/table-list-formatter.rb | 39 -
ruby/red-arrow/lib/arrow/table-loader.rb | 187 -----
ruby/red-arrow/lib/arrow/table-saver.rb | 169 -----
ruby/red-arrow/lib/arrow/table-table-formatter.rb | 73 --
ruby/red-arrow/lib/arrow/table.rb | 525 --------------
ruby/red-arrow/lib/arrow/tensor.rb | 24 -
ruby/red-arrow/lib/arrow/time.rb | 159 -----
ruby/red-arrow/lib/arrow/time32-array-builder.rb | 49 --
ruby/red-arrow/lib/arrow/time32-array.rb | 28 -
ruby/red-arrow/lib/arrow/time32-data-type.rb | 61 --
ruby/red-arrow/lib/arrow/time64-array-builder.rb | 49 --
ruby/red-arrow/lib/arrow/time64-array.rb | 28 -
ruby/red-arrow/lib/arrow/time64-data-type.rb | 61 --
.../red-arrow/lib/arrow/timestamp-array-builder.rb | 65 --
ruby/red-arrow/lib/arrow/timestamp-array.rb | 42 --
ruby/red-arrow/lib/arrow/timestamp-data-type.rb | 57 --
ruby/red-arrow/lib/arrow/version.rb | 26 -
ruby/red-arrow/lib/arrow/writable.rb | 22 -
ruby/red-arrow/red-arrow.gemspec | 66 --
ruby/red-arrow/test/fixture/TestOrcFile.test1.orc | Bin 1711 -> 0 bytes
ruby/red-arrow/test/fixture/float-integer.csv | 20 -
ruby/red-arrow/test/fixture/integer-float.csv | 20 -
.../test/fixture/null-with-double-quote.csv | 20 -
.../test/fixture/null-without-double-quote.csv | 20 -
ruby/red-arrow/test/fixture/with-header-float.csv | 20 -
ruby/red-arrow/test/fixture/with-header.csv | 20 -
.../test/fixture/without-header-float.csv | 19 -
ruby/red-arrow/test/fixture/without-header.csv | 19 -
ruby/red-arrow/test/helper.rb | 27 -
ruby/red-arrow/test/helper/fixture.rb | 28 -
ruby/red-arrow/test/helper/omittable.rb | 36 -
.../test/raw-records/test-basic-arrays.rb | 365 ----------
.../test/raw-records/test-dense-union-array.rb | 480 -------------
ruby/red-arrow/test/raw-records/test-list-array.rb | 552 ---------------
.../test/raw-records/test-multiple-columns.rb | 65 --
.../test/raw-records/test-sparse-union-array.rb | 470 ------------
.../test/raw-records/test-struct-array.rb | 470 ------------
ruby/red-arrow/test/raw-records/test-table.rb | 47 --
ruby/red-arrow/test/run-test.rb | 71 --
ruby/red-arrow/test/test-array-builder.rb | 129 ----
ruby/red-arrow/test/test-array.rb | 291 --------
ruby/red-arrow/test/test-bigdecimal.rb | 40 --
ruby/red-arrow/test/test-buffer.rb | 49 --
ruby/red-arrow/test/test-chunked-array.rb | 183 -----
ruby/red-arrow/test/test-column.rb | 92 ---
ruby/red-arrow/test/test-csv-loader.rb | 250 -------
ruby/red-arrow/test/test-data-type.rb | 83 ---
ruby/red-arrow/test/test-date32-array.rb | 24 -
ruby/red-arrow/test/test-date64-array.rb | 25 -
.../test/test-decimal128-array-builder.rb | 112 ---
ruby/red-arrow/test/test-decimal128-array.rb | 38 -
ruby/red-arrow/test/test-decimal128-data-type.rb | 31 -
ruby/red-arrow/test/test-decimal128.rb | 102 ---
.../test/test-decimal256-array-builder.rb | 112 ---
ruby/red-arrow/test/test-decimal256-array.rb | 38 -
ruby/red-arrow/test/test-decimal256-data-type.rb | 31 -
ruby/red-arrow/test/test-decimal256.rb | 102 ---
ruby/red-arrow/test/test-dense-union-data-type.rb | 41 --
ruby/red-arrow/test/test-dictionary-array.rb | 41 --
ruby/red-arrow/test/test-dictionary-data-type.rb | 40 --
ruby/red-arrow/test/test-feather.rb | 49 --
ruby/red-arrow/test/test-field.rb | 91 ---
ruby/red-arrow/test/test-file-output-stream.rb | 54 --
.../test/test-fixed-size-binary-array-builder.rb | 92 ---
.../red-arrow/test/test-fixed-size-binary-array.rb | 36 -
ruby/red-arrow/test/test-group.rb | 156 ----
ruby/red-arrow/test/test-list-array-builder.rb | 79 ---
ruby/red-arrow/test/test-list-array.rb | 32 -
ruby/red-arrow/test/test-list-data-type.rb | 69 --
ruby/red-arrow/test/test-null-array.rb | 23 -
ruby/red-arrow/test/test-orc.rb | 177 -----
ruby/red-arrow/test/test-record-batch-builder.rb | 125 ----
.../test/test-record-batch-file-reader.rb | 115 ---
ruby/red-arrow/test/test-record-batch-iterator.rb | 37 -
ruby/red-arrow/test/test-record-batch.rb | 140 ----
ruby/red-arrow/test/test-rolling-window.rb | 40 --
ruby/red-arrow/test/test-schema.rb | 134 ----
ruby/red-arrow/test/test-slicer.rb | 488 -------------
ruby/red-arrow/test/test-sort-indices.rb | 40 --
ruby/red-arrow/test/test-sort-key.rb | 81 ---
ruby/red-arrow/test/test-sort-options.rb | 58 --
ruby/red-arrow/test/test-sparse-union-data-type.rb | 41 --
ruby/red-arrow/test/test-struct-array-builder.rb | 184 -----
ruby/red-arrow/test/test-struct-array.rb | 94 ---
ruby/red-arrow/test/test-struct-data-type.rb | 112 ---
ruby/red-arrow/test/test-table.rb | 788 ---------------------
ruby/red-arrow/test/test-tensor.rb | 56 --
ruby/red-arrow/test/test-time.rb | 288 --------
ruby/red-arrow/test/test-time32-array.rb | 81 ---
ruby/red-arrow/test/test-time32-data-type.rb | 42 --
ruby/red-arrow/test/test-time64-array.rb | 81 ---
ruby/red-arrow/test/test-time64-data-type.rb | 42 --
ruby/red-arrow/test/test-timestamp-array.rb | 45 --
ruby/red-arrow/test/test-timestamp-data-type.rb | 42 --
ruby/red-arrow/test/values/test-basic-arrays.rb | 295 --------
.../test/values/test-dense-union-array.rb | 468 ------------
ruby/red-arrow/test/values/test-list-array.rb | 515 --------------
.../test/values/test-sparse-union-array.rb | 459 ------------
ruby/red-arrow/test/values/test-struct-array.rb | 467 ------------
ruby/red-gandiva/.gitignore | 18 -
ruby/red-gandiva/Gemfile | 24 -
ruby/red-gandiva/LICENSE.txt | 202 ------
ruby/red-gandiva/NOTICE.txt | 2 -
ruby/red-gandiva/README.md | 68 --
ruby/red-gandiva/Rakefile | 41 --
ruby/red-gandiva/dependency-check/Rakefile | 47 --
ruby/red-gandiva/lib/gandiva.rb | 29 -
ruby/red-gandiva/lib/gandiva/arrow-schema.rb | 25 -
ruby/red-gandiva/lib/gandiva/expression-builder.rb | 45 --
.../lib/gandiva/expression-builder/add.rb | 40 --
.../gandiva/expression-builder/binary-operation.rb | 38 -
.../lib/gandiva/expression-builder/context.rb | 26 -
.../lib/gandiva/expression-builder/divide.rb | 34 -
.../lib/gandiva/expression-builder/elsif.rb | 36 -
.../lib/gandiva/expression-builder/equal.rb | 33 -
.../lib/gandiva/expression-builder/field.rb | 32 -
.../lib/gandiva/expression-builder/greater-than.rb | 33 -
.../lib/gandiva/expression-builder/if.rb | 75 --
.../lib/gandiva/expression-builder/less-than.rb | 33 -
.../lib/gandiva/expression-builder/literal.rb | 65 --
.../lib/gandiva/expression-builder/multiply.rb | 34 -
.../lib/gandiva/expression-builder/record.rb | 45 --
.../lib/gandiva/expression-builder/subtract.rb | 34 -
.../lib/gandiva/expression-builder/value.rb | 55 --
ruby/red-gandiva/lib/gandiva/loader.rb | 49 --
ruby/red-gandiva/lib/gandiva/version.rb | 26 -
ruby/red-gandiva/red-gandiva.gemspec | 49 --
.../test/expression-builder/test-add.rb | 54 --
.../test/expression-builder/test-record.rb | 45 --
ruby/red-gandiva/test/helper.rb | 20 -
ruby/red-gandiva/test/run-test.rb | 50 --
ruby/red-gandiva/test/test-boolean-literal-node.rb | 24 -
ruby/red-gandiva/test/test-projector.rb | 49 --
ruby/red-parquet/.gitignore | 18 -
ruby/red-parquet/Gemfile | 24 -
ruby/red-parquet/LICENSE.txt | 202 ------
ruby/red-parquet/NOTICE.txt | 2 -
ruby/red-parquet/README.md | 52 --
ruby/red-parquet/Rakefile | 41 --
ruby/red-parquet/dependency-check/Rakefile | 47 --
ruby/red-parquet/lib/parquet.rb | 29 -
.../lib/parquet/arrow-table-loadable.rb | 36 -
.../red-parquet/lib/parquet/arrow-table-savable.rb | 52 --
ruby/red-parquet/lib/parquet/loader.rb | 46 --
ruby/red-parquet/lib/parquet/version.rb | 26 -
ruby/red-parquet/lib/parquet/writer-properties.rb | 28 -
ruby/red-parquet/red-parquet.gemspec | 49 --
ruby/red-parquet/test/helper.rb | 22 -
ruby/red-parquet/test/run-test.rb | 50 --
ruby/red-parquet/test/test-arrow-table.rb | 99 ---
ruby/red-plasma/.gitignore | 18 -
ruby/red-plasma/Gemfile | 24 -
ruby/red-plasma/LICENSE.txt | 202 ------
ruby/red-plasma/NOTICE.txt | 2 -
ruby/red-plasma/README.md | 58 --
ruby/red-plasma/Rakefile | 41 --
ruby/red-plasma/dependency-check/Rakefile | 47 --
ruby/red-plasma/lib/plasma.rb | 29 -
ruby/red-plasma/lib/plasma/client.rb | 35 -
ruby/red-plasma/lib/plasma/loader.rb | 35 -
ruby/red-plasma/lib/plasma/version.rb | 26 -
ruby/red-plasma/red-plasma.gemspec | 49 --
ruby/red-plasma/test/helper.rb | 25 -
ruby/red-plasma/test/helper/omittable.rb | 36 -
ruby/red-plasma/test/helper/plasma-store.rb | 57 --
ruby/red-plasma/test/run-test.rb | 50 --
ruby/red-plasma/test/test-plasma-client.rb | 53 --
297 files changed, 24933 deletions(-)
diff --git a/ruby/Gemfile b/ruby/Gemfile
deleted file mode 100644
index 002a2a0..0000000
--- a/ruby/Gemfile
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source "https://rubygems.org/"
-
-gem "pkg-config"
diff --git a/ruby/README.md b/ruby/README.md
deleted file mode 100644
index fbcf615..0000000
--- a/ruby/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Apache Arrow Ruby
-
-There are the official Ruby bindings for Apache Arrow.
-
-[Red Arrow](https://github.com/apache/arrow/tree/master/ruby/red-arrow) is the base Apache Arrow bindings.
-
-[Red Arrow CUDA](https://github.com/apache/arrow/tree/master/ruby/red-arrow-cuda) is the Apache Arrow bindings of CUDA part.
-
-[Red Arrow Dataset](https://github.com/apache/arrow/tree/master/ruby/red-arrow-dataset) is the Apache Arrow Dataset bindings.
-
-[Red Gandiva](https://github.com/apache/arrow/tree/master/ruby/red-gandiva) is the Gandiva bindings.
-
-[Red Plasma](https://github.com/apache/arrow/tree/master/ruby/red-plasma) is the Plasma bindings.
-
-[Red Parquet](https://github.com/apache/arrow/tree/master/ruby/red-parquet) is the Parquet bindings.
-
-
diff --git a/ruby/Rakefile b/ruby/Rakefile
deleted file mode 100644
index 64559ef..0000000
--- a/ruby/Rakefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "pkg-config"
-
-base_dir = File.join(__dir__)
-
-packages = []
-Dir.glob("#{base_dir}/*/*.gemspec") do |gemspec|
- package = File.basename(File.dirname(gemspec))
- glib_package_name = package.gsub(/\Ared-/, "") + "-glib"
- next unless PKGConfig.exist?(glib_package_name)
- packages << package
-end
-
-packages.each do |package|
- desc "Run test for #{package}"
- task package do
- cd(File.join(base_dir, package)) do
- if ENV["USE_BUNDLER"]
- sh("bundle", "exec", "rake")
- else
- ruby("-S", "rake")
- end
- end
- end
-end
-
-sorted_packages = packages.sort_by do |package|
- if package == "red-arrow"
- "000-#{package}"
- else
- package
- end
-end
-
-desc "Run test for all packages"
-task all: sorted_packages
-
-task default: :all
diff --git a/ruby/red-arrow-cuda/.gitignore b/ruby/red-arrow-cuda/.gitignore
deleted file mode 100644
index 779545d..0000000
--- a/ruby/red-arrow-cuda/.gitignore
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-/pkg/
diff --git a/ruby/red-arrow-cuda/Gemfile b/ruby/red-arrow-cuda/Gemfile
deleted file mode 100644
index 7c4cefc..0000000
--- a/ruby/red-arrow-cuda/Gemfile
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source "https://rubygems.org/"
-
-gemspec
-
-gem "red-arrow", path: "../red-arrow"
diff --git a/ruby/red-arrow-cuda/LICENSE.txt b/ruby/red-arrow-cuda/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/ruby/red-arrow-cuda/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/ruby/red-arrow-cuda/NOTICE.txt b/ruby/red-arrow-cuda/NOTICE.txt
deleted file mode 100644
index e08aeda..0000000
--- a/ruby/red-arrow-cuda/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache Arrow
-Copyright 2016 The Apache Software Foundation
diff --git a/ruby/red-arrow-cuda/README.md b/ruby/red-arrow-cuda/README.md
deleted file mode 100644
index f05e664..0000000
--- a/ruby/red-arrow-cuda/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Red Arrow CUDA - Apache Arrow CUDA Ruby
-
-Red Arrow CUDA is the Ruby bindings of Apache Arrow CUDA. Red Arrow CUDA is based on GObject Introspection.
-
-[Apache Arrow CUDA](https://arrow.apache.org/) is an in-memory columnar data store on GPU.
-
-[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.
-
-Red Arrow CUDA uses [Apache Arrow CUDA 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 CUDA.
-
-Apache Arrow CUDA GLib is a C wrapper for [Apache Arrow CUDA C++](https://github.com/apache/arrow/tree/master/cpp). GObject Introspection can't use Apache Arrow CUDA C++ directly. Apache Arrow CUDA GLib is a bridge between Apache Arrow CUDA C++ and GObject Introspection.
-
-gobject-introspection gem is a Ruby bindings of GObject Introspection. Red Arrow CUDA uses GObject Introspection via gobject-introspection gem.
-
-## Install
-
-Install Apache Arrow CUDA GLib before install Red Arrow CUDA. Install Apache Arrow GLib before install Red Arrow. See [Apache Arrow install document](https://arrow.apache.org/install/) for details.
-
-Install Red Arrow CUDA after you install Apache Arrow CUDA GLib:
-
-```text
-% gem install red-arrow-cuda
-```
-
-## Usage
-
-```ruby
-require "arrow-cuda"
-
-manager = ArrowCUDA::DeviceManager.new
-if manager.n_devices.zero?
- raise "No GPU is found"
-end
-
-context = manager[0]
-buffer = ArrowCUDA::Buffer.new(context, 128)
-ArrowCUDA::BufferOutputStream.open(buffer) do |stream|
- stream.write("Hello World")
-end
-puts buffer.copy_to_host(0, 11) # => "Hello World"
-```
diff --git a/ruby/red-arrow-cuda/Rakefile b/ruby/red-arrow-cuda/Rakefile
deleted file mode 100644
index 2bbe6e7..0000000
--- a/ruby/red-arrow-cuda/Rakefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "rubygems"
-require "bundler/gem_helper"
-
-base_dir = File.join(File.dirname(__FILE__))
-
-helper = Bundler::GemHelper.new(base_dir)
-helper.install
-
-release_task = Rake::Task["release"]
-release_task.prerequisites.replace(["build", "release:rubygem_push"])
-
-desc "Run tests"
-task :test do
- cd(base_dir) do
- cd("dependency-check") do
- ruby("-S", "rake")
- end
- ruby("test/run-test.rb")
- end
-end
-
-task default: :test
diff --git a/ruby/red-arrow-cuda/dependency-check/Rakefile b/ruby/red-arrow-cuda/dependency-check/Rakefile
deleted file mode 100644
index 518c1a6..0000000
--- a/ruby/red-arrow-cuda/dependency-check/Rakefile
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "pkg-config"
-require "native-package-installer"
-require_relative "../lib/arrow-cuda/version"
-
-case RUBY_PLATFORM
-when /mingw|mswin/
- task :default => "nothing"
-else
- task :default => "dependency:check"
-end
-
-task :nothing do
-end
-
-namespace :dependency do
- desc "Check dependency"
- task :check do
- unless PKGConfig.check_version?("arrow-cuda-glib",
- ArrowCUDA::Version::MAJOR,
- ArrowCUDA::Version::MINOR,
- ArrowCUDA::Version::MICRO)
- unless NativePackageInstaller.install(:debian => "libarrow-cuda-glib-dev",
- :redhat => "arrow-cuda-glib-devel")
- exit(false)
- end
- end
- end
-end
diff --git a/ruby/red-arrow-cuda/lib/arrow-cuda.rb b/ruby/red-arrow-cuda/lib/arrow-cuda.rb
deleted file mode 100644
index 1fc13d0..0000000
--- a/ruby/red-arrow-cuda/lib/arrow-cuda.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-require "arrow-cuda/version"
-
-require "arrow-cuda/loader"
-
-module ArrowCUDA
- class Error < StandardError
- end
-
- Loader.load
-end
diff --git a/ruby/red-arrow-cuda/lib/arrow-cuda/device-manager.rb b/ruby/red-arrow-cuda/lib/arrow-cuda/device-manager.rb
deleted file mode 100644
index bbef749..0000000
--- a/ruby/red-arrow-cuda/lib/arrow-cuda/device-manager.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowCUDA
- class DeviceManager
- # Experimental.
- #
- # Can we think device manager is a container of contexts?
- alias_method :[], :get_context
- end
-end
diff --git a/ruby/red-arrow-cuda/lib/arrow-cuda/loader.rb b/ruby/red-arrow-cuda/lib/arrow-cuda/loader.rb
deleted file mode 100644
index 6b2afc4..0000000
--- a/ruby/red-arrow-cuda/lib/arrow-cuda/loader.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowCUDA
- class Loader < GObjectIntrospection::Loader
- class << self
- def load
- super("ArrowCUDA", ArrowCUDA)
- end
- end
-
- private
- def post_load(repository, namespace)
- require_libraries
- end
-
- def require_libraries
- require "arrow-cuda/device-manager"
- end
- end
-end
diff --git a/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb b/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb
deleted file mode 100644
index d4031e5..0000000
--- a/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowCUDA
- VERSION = "4.0.0-SNAPSHOT"
-
- module Version
- numbers, TAG = VERSION.split("-")
- MAJOR, MINOR, MICRO = numbers.split(".").collect(&:to_i)
- STRING = VERSION
- end
-end
diff --git a/ruby/red-arrow-cuda/red-arrow-cuda.gemspec b/ruby/red-arrow-cuda/red-arrow-cuda.gemspec
deleted file mode 100644
index 7bb34c6..0000000
--- a/ruby/red-arrow-cuda/red-arrow-cuda.gemspec
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require_relative "lib/arrow-cuda/version"
-
-Gem::Specification.new do |spec|
- spec.name = "red-arrow-cuda"
- version_components = [
- ArrowCUDA::Version::MAJOR.to_s,
- ArrowCUDA::Version::MINOR.to_s,
- ArrowCUDA::Version::MICRO.to_s,
- ArrowCUDA::Version::TAG,
- ]
- spec.version = version_components.compact.join(".")
- spec.homepage = "https://arrow.apache.org/"
- spec.authors = ["Apache Arrow Developers"]
- spec.email = ["dev@arrow.apache.org"]
-
- spec.summary = "Red Arrow CUDA is the Ruby bindings of Apache Arrow CUDA"
- spec.description =
- "Apache Arrow CUDA is a common in-memory columnar data store on CUDA. " +
- "It's useful to share and process large data."
- spec.license = "Apache-2.0"
- spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"]
- spec.files += ["LICENSE.txt", "NOTICE.txt"]
- spec.files += Dir.glob("lib/**/*.rb")
- spec.test_files += Dir.glob("test/**/*")
- spec.extensions = ["dependency-check/Rakefile"]
-
- spec.add_runtime_dependency("red-arrow", "= #{spec.version}")
-
- spec.add_development_dependency("bundler")
- spec.add_development_dependency("rake")
- spec.add_development_dependency("test-unit")
-end
diff --git a/ruby/red-arrow-cuda/test/helper.rb b/ruby/red-arrow-cuda/test/helper.rb
deleted file mode 100644
index 045eb10..0000000
--- a/ruby/red-arrow-cuda/test/helper.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow-cuda"
-
-require "test-unit"
diff --git a/ruby/red-arrow-cuda/test/run-test.rb b/ruby/red-arrow-cuda/test/run-test.rb
deleted file mode 100755
index 48d2c49..0000000
--- a/ruby/red-arrow-cuda/test/run-test.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$VERBOSE = true
-
-require "pathname"
-
-(ENV["ARROW_DLL_PATH"] || "").split(File::PATH_SEPARATOR).each do |path|
- RubyInstaller::Runtime.add_dll_directory(path)
-end
-
-base_dir = Pathname.new(__dir__).parent.expand_path
-arrow_base_dir = base_dir.parent + "red-arrow"
-
-lib_dir = base_dir + "lib"
-test_dir = base_dir + "test"
-
-arrow_lib_dir = arrow_base_dir + "lib"
-arrow_ext_dir = arrow_base_dir + "ext" + "arrow"
-
-build_dir = ENV["BUILD_DIR"]
-if build_dir
- arrow_build_dir = Pathname.new(build_dir) + "red-arrow"
-else
- arrow_build_dir = arrow_ext_dir
-end
-
-$LOAD_PATH.unshift(arrow_build_dir.to_s)
-$LOAD_PATH.unshift(arrow_lib_dir.to_s)
-$LOAD_PATH.unshift(lib_dir.to_s)
-
-require_relative "helper"
-
-exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))
diff --git a/ruby/red-arrow-cuda/test/test-cuda.rb b/ruby/red-arrow-cuda/test/test-cuda.rb
deleted file mode 100644
index a48b687..0000000
--- a/ruby/red-arrow-cuda/test/test-cuda.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-class TestCUDA < Test::Unit::TestCase
- def setup
- @manager = ArrowCUDA::DeviceManager.new
- omit("At least one GPU is required") if @manager.n_devices.zero?
- @context = @manager[0]
- end
-
- sub_test_case("BufferOutputStream") do
- def setup
- super
- @buffer = ArrowCUDA::Buffer.new(@context, 128)
- end
-
- def test_new
- ArrowCUDA::BufferOutputStream.open(@buffer) do |stream|
- stream.write("Hello World")
- end
- assert_equal("Hello World", @buffer.copy_to_host(0, 11).to_s)
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/.gitignore b/ruby/red-arrow-dataset/.gitignore
deleted file mode 100644
index 779545d..0000000
--- a/ruby/red-arrow-dataset/.gitignore
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-/pkg/
diff --git a/ruby/red-arrow-dataset/Gemfile b/ruby/red-arrow-dataset/Gemfile
deleted file mode 100644
index 7c4cefc..0000000
--- a/ruby/red-arrow-dataset/Gemfile
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source "https://rubygems.org/"
-
-gemspec
-
-gem "red-arrow", path: "../red-arrow"
diff --git a/ruby/red-arrow-dataset/LICENSE.txt b/ruby/red-arrow-dataset/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/ruby/red-arrow-dataset/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/ruby/red-arrow-dataset/NOTICE.txt b/ruby/red-arrow-dataset/NOTICE.txt
deleted file mode 100644
index e08aeda..0000000
--- a/ruby/red-arrow-dataset/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache Arrow
-Copyright 2016 The Apache Software Foundation
diff --git a/ruby/red-arrow-dataset/README.md b/ruby/red-arrow-dataset/README.md
deleted file mode 100644
index b48ef0b..0000000
--- a/ruby/red-arrow-dataset/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Red Arrow Dataset - Apache Arrow Dataset Ruby
-
-Red Arrow Dataset is the Ruby bindings of Apache Arrow Dataset. Red Arrow Dataset is based on GObject Introspection.
-
-[Apache Arrow Dataset](https://arrow.apache.org/) is one of Apache Arrow components to read and write semantic datasets stored in different locations and formats.
-
-[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.
-
-Red Arrow Dataset uses [Apache Arrow Dataset 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 Dataset.
-
-Apache Arrow Dataset GLib is a C wrapper for [Apache Arrow Dataset C++](https://github.com/apache/arrow/tree/master/cpp). GObject Introspection can't use Apache Arrow Dataset C++ directly. Apache Arrow Dataset GLib is a bridge between Apache Arrow Dataset C++ and GObject Introspection.
-
-gobject-introspection gem is a Ruby bindings of GObject Introspection. Red Arrow Dataset uses GObject Introspection via gobject-introspection gem.
-
-## Install
-
-Install Apache Arrow Dataset GLib before install Red Arrow Dataset. Install Apache Arrow GLib before install Red Arrow. See [Apache Arrow install document](https://arrow.apache.org/install/) for details.
-
-Install Red Arrow Dataset after you install Apache Arrow Dataset GLib:
-
-```console
-$ gem install red-arrow-dataset
-```
-
-## Usage
-
-```ruby
-require "arrow-dataset"
-
-# TODO
-```
diff --git a/ruby/red-arrow-dataset/Rakefile b/ruby/red-arrow-dataset/Rakefile
deleted file mode 100644
index 2bbe6e7..0000000
--- a/ruby/red-arrow-dataset/Rakefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "rubygems"
-require "bundler/gem_helper"
-
-base_dir = File.join(File.dirname(__FILE__))
-
-helper = Bundler::GemHelper.new(base_dir)
-helper.install
-
-release_task = Rake::Task["release"]
-release_task.prerequisites.replace(["build", "release:rubygem_push"])
-
-desc "Run tests"
-task :test do
- cd(base_dir) do
- cd("dependency-check") do
- ruby("-S", "rake")
- end
- ruby("test/run-test.rb")
- end
-end
-
-task default: :test
diff --git a/ruby/red-arrow-dataset/dependency-check/Rakefile b/ruby/red-arrow-dataset/dependency-check/Rakefile
deleted file mode 100644
index df2e249..0000000
--- a/ruby/red-arrow-dataset/dependency-check/Rakefile
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "pkg-config"
-require "native-package-installer"
-require_relative "../lib/arrow-dataset/version"
-
-case RUBY_PLATFORM
-when /mingw|mswin/
- task :default => "nothing"
-else
- task :default => "dependency:check"
-end
-
-task :nothing do
-end
-
-namespace :dependency do
- desc "Check dependency"
- task :check do
- unless PKGConfig.check_version?("arrow-dataset-glib",
- ArrowDataset::Version::MAJOR,
- ArrowDataset::Version::MINOR,
- ArrowDataset::Version::MICRO)
- unless NativePackageInstaller.install(:debian => "libarrow-dataset-glib-dev",
- :redhat => "arrow-dataset-glib-devel")
- exit(false)
- end
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset.rb b/ruby/red-arrow-dataset/lib/arrow-dataset.rb
deleted file mode 100644
index fe4f2d5..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-require "arrow-dataset/version"
-
-require "arrow-dataset/loader"
-
-module ArrowDataset
- class Error < StandardError
- end
-
- Loader.load
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-fragment.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-fragment.rb
deleted file mode 100644
index 917d6c7..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-fragment.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowDataset
- class InMemoryFragment
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- def initialize(schema, record_batches)
- record_batches = record_batches.collect do |record_batch|
- unless record_batch.is_a?(Arrow::RecordBatch)
- record_batch = Arrow::RecordBatch.new(record_batch)
- end
- record_batch
- end
- initialize_raw(schema, record_batches)
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-scan-task.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-scan-task.rb
deleted file mode 100644
index 5e127e1..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset/in-memory-scan-task.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowDataset
- class InMemoryScanTask
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- def initialize(record_batches, **options)
- record_batches = record_batches.collect do |record_batch|
- unless record_batch.is_a?(Arrow::RecordBatch)
- record_batch = Arrow::RecordBatch.new(record_batch)
- end
- record_batch
- end
- options[:schema] ||= record_batches.first.schema
- fragment = options.delete(:fragment)
- fragment ||= InMemoryFragment.new(options[:schema], record_batches)
- initialize_raw(record_batches, options, fragment)
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/loader.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/loader.rb
deleted file mode 100644
index fcac52d..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset/loader.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowDataset
- class Loader < GObjectIntrospection::Loader
- class << self
- def load
- super("ArrowDataset", ArrowDataset)
- end
- end
-
- private
- def post_load(repository, namespace)
- require_libraries
- end
-
- def require_libraries
- require "arrow-dataset/in-memory-scan-task"
- require "arrow-dataset/scan-options"
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/scan-options.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/scan-options.rb
deleted file mode 100644
index 1467743..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset/scan-options.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowDataset
- class ScanOptions
- class << self
- def try_convert(value)
- case value
- when Hash
- return nil unless value.key?(:schema)
- options = new(value[:schema])
- value.each do |name, value|
- next if name == :schema
- options.__send__("#{name}=", value)
- end
- options
- else
- nil
- end
- end
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb
deleted file mode 100644
index 0f1e354..0000000
--- a/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module ArrowDataset
- VERSION = "4.0.0-SNAPSHOT"
-
- module Version
- numbers, TAG = VERSION.split("-")
- MAJOR, MINOR, MICRO = numbers.split(".").collect(&:to_i)
- STRING = VERSION
- end
-end
diff --git a/ruby/red-arrow-dataset/red-arrow-dataset.gemspec b/ruby/red-arrow-dataset/red-arrow-dataset.gemspec
deleted file mode 100644
index 0a60925..0000000
--- a/ruby/red-arrow-dataset/red-arrow-dataset.gemspec
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require_relative "lib/arrow-dataset/version"
-
-Gem::Specification.new do |spec|
- spec.name = "red-arrow-dataset"
- version_components = [
- ArrowDataset::Version::MAJOR.to_s,
- ArrowDataset::Version::MINOR.to_s,
- ArrowDataset::Version::MICRO.to_s,
- ArrowDataset::Version::TAG,
- ]
- spec.version = version_components.compact.join(".")
- spec.homepage = "https://arrow.apache.org/"
- spec.authors = ["Apache Arrow Developers"]
- spec.email = ["dev@arrow.apache.org"]
-
- spec.summary = "Red Arrow Dataset is the Ruby bindings of Apache Arrow Dataset"
- spec.description =
- "Apache Arrow Dataset is one of Apache Arrow components to read and write " +
- "semantic datasets stored in different locations and formats."
- spec.license = "Apache-2.0"
- spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"]
- spec.files += ["LICENSE.txt", "NOTICE.txt"]
- spec.files += Dir.glob("lib/**/*.rb")
- spec.test_files += Dir.glob("test/**/*")
- spec.extensions = ["dependency-check/Rakefile"]
-
- spec.add_runtime_dependency("red-arrow", "= #{spec.version}")
-
- spec.add_development_dependency("bundler")
- spec.add_development_dependency("rake")
- spec.add_development_dependency("test-unit")
-end
diff --git a/ruby/red-arrow-dataset/test/helper.rb b/ruby/red-arrow-dataset/test/helper.rb
deleted file mode 100644
index 795df3b..0000000
--- a/ruby/red-arrow-dataset/test/helper.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow-dataset"
-
-require "test-unit"
diff --git a/ruby/red-arrow-dataset/test/run-test.rb b/ruby/red-arrow-dataset/test/run-test.rb
deleted file mode 100755
index 48d2c49..0000000
--- a/ruby/red-arrow-dataset/test/run-test.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$VERBOSE = true
-
-require "pathname"
-
-(ENV["ARROW_DLL_PATH"] || "").split(File::PATH_SEPARATOR).each do |path|
- RubyInstaller::Runtime.add_dll_directory(path)
-end
-
-base_dir = Pathname.new(__dir__).parent.expand_path
-arrow_base_dir = base_dir.parent + "red-arrow"
-
-lib_dir = base_dir + "lib"
-test_dir = base_dir + "test"
-
-arrow_lib_dir = arrow_base_dir + "lib"
-arrow_ext_dir = arrow_base_dir + "ext" + "arrow"
-
-build_dir = ENV["BUILD_DIR"]
-if build_dir
- arrow_build_dir = Pathname.new(build_dir) + "red-arrow"
-else
- arrow_build_dir = arrow_ext_dir
-end
-
-$LOAD_PATH.unshift(arrow_build_dir.to_s)
-$LOAD_PATH.unshift(arrow_lib_dir.to_s)
-$LOAD_PATH.unshift(lib_dir.to_s)
-
-require_relative "helper"
-
-exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))
diff --git a/ruby/red-arrow-dataset/test/test-in-memory-scan-task.rb b/ruby/red-arrow-dataset/test/test-in-memory-scan-task.rb
deleted file mode 100644
index 37f041d..0000000
--- a/ruby/red-arrow-dataset/test/test-in-memory-scan-task.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-class TestInMemoryScanTask < Test::Unit::TestCase
- def setup
- @record_batches = [
- Arrow::RecordBatch.new(visible: [true, false, true],
- point: [1, 2, 3]),
- ]
- end
-
- sub_test_case(".new") do
- test("[[Arrow::RecordBatch]]") do
- scan_task = ArrowDataset::InMemoryScanTask.new(@record_batches)
- assert_equal(@record_batches,
- scan_task.execute.to_a)
- end
- end
-end
diff --git a/ruby/red-arrow-dataset/test/test-scan-options.rb b/ruby/red-arrow-dataset/test/test-scan-options.rb
deleted file mode 100644
index a9a947f..0000000
--- a/ruby/red-arrow-dataset/test/test-scan-options.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-class TestScanOptions < Test::Unit::TestCase
- def setup
- @record_batches = [
- Arrow::RecordBatch.new(visible: [true, false, true],
- point: [1, 2, 3]),
- ]
- @schema = @record_batches.first.schema
- end
-
- sub_test_case(".try_convert") do
- def test_hash
- batch_size = 1024
- context = ArrowDataset::ScanOptions.try_convert(schema: @schema,
- batch_size: batch_size)
- assert_equal([@schema, batch_size],
- [context.schema, context.batch_size])
- end
- end
-end
diff --git a/ruby/red-arrow/.gitignore b/ruby/red-arrow/.gitignore
deleted file mode 100644
index e41483f..0000000
--- a/ruby/red-arrow/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-/.yardoc/
-/doc/reference/
-/ext/arrow/Makefile
-/ext/arrow/mkmf.log
-/pkg/
diff --git a/ruby/red-arrow/.yardopts b/ruby/red-arrow/.yardopts
deleted file mode 100644
index 67159b1..0000000
--- a/ruby/red-arrow/.yardopts
+++ /dev/null
@@ -1,6 +0,0 @@
---output-dir doc/reference
---markup markdown
---no-private
-lib/**/*.rb
--
-doc/text/*
diff --git a/ruby/red-arrow/Gemfile b/ruby/red-arrow/Gemfile
deleted file mode 100644
index 3907918..0000000
--- a/ruby/red-arrow/Gemfile
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source "https://rubygems.org/"
-
-gemspec
diff --git a/ruby/red-arrow/LICENSE.txt b/ruby/red-arrow/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/ruby/red-arrow/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/ruby/red-arrow/NOTICE.txt b/ruby/red-arrow/NOTICE.txt
deleted file mode 100644
index e08aeda..0000000
--- a/ruby/red-arrow/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache Arrow
-Copyright 2016 The Apache Software Foundation
diff --git a/ruby/red-arrow/README.md b/ruby/red-arrow/README.md
deleted file mode 100644
index 20ca83f..0000000
--- a/ruby/red-arrow/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Red Arrow - Apache Arrow Ruby
-
-Red Arrow is the Ruby bindings of Apache Arrow. Red Arrow is based on GObject Introspection.
-
-[Apache Arrow](https://arrow.apache.org/) is an in-memory columnar data store. It's used by many products for data analytics.
-
-[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.
-
-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.
-
-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.
-
-gobject-introspection gem is a Ruby bindings of GObject Introspection. Red Arrow uses GObject Introspection via gobject-introspection gem.
-
-## Install
-
-Install Apache Arrow GLib before install Red Arrow. See [Apache Arrow install document](https://arrow.apache.org/install/) for details.
-
-Install Red Arrow after you install Apache Arrow GLib:
-
-```console
-% gem install red-arrow
-```
-
-## Usage
-
-```ruby
-require "arrow"
-
-table = Arrow::Table.load("/dev/shm/data.arrow")
-# Process data in table
-table.save("/dev/shm/data-processed.arrow")
-```
diff --git a/ruby/red-arrow/Rakefile b/ruby/red-arrow/Rakefile
deleted file mode 100644
index dd2c310..0000000
--- a/ruby/red-arrow/Rakefile
+++ /dev/null
@@ -1,100 +0,0 @@
-# -*- ruby -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "bundler/gem_helper"
-require "rake/clean"
-require "yard"
-
-base_dir = File.join(__dir__)
-
-helper = Bundler::GemHelper.new(base_dir)
-helper.install
-spec = helper.gemspec
-
-release_task = Rake::Task["release"]
-release_task.prerequisites.replace(["build", "release:rubygem_push"])
-
-def run_extconf(build_dir, extension_dir, *arguments)
- cd(build_dir) do
- ruby(File.join(extension_dir, "extconf.rb"),
- *arguments)
- end
-end
-
-spec.extensions.each do |extension|
- extension_dir = File.join(base_dir, File.dirname(extension))
- build_dir = ENV["BUILD_DIR"]
- if build_dir
- build_dir = File.join(build_dir, "red-arrow")
- directory build_dir
- else
- build_dir = extension_dir
- end
- CLOBBER << File.join(build_dir, "Makefile")
- CLOBBER << File.join(build_dir, "mkmf.log")
-
- makefile = File.join(build_dir, "Makefile")
- file makefile => build_dir do
- run_extconf(build_dir, extension_dir)
- end
-
- desc "Configure"
- task :configure => build_dir do
- run_extconf(build_dir, extension_dir)
- end
-
- desc "Compile"
- task :compile => makefile do
- cd(build_dir) do
- sh("make")
- end
- end
-
- task :clean do
- cd(build_dir) do
- sh("make", "clean") if File.exist?("Makefile")
- end
- end
-end
-
-desc "Run tests"
-task :test do
- cd(base_dir) do
- ruby("test/run-test.rb")
- end
-end
-
-task default: :test
-
-desc "Run benchmarks"
-task :benchmark do
- benchmarks = if ENV["BENCHMARKS"]
- ENV["BENCHMARKS"].split
- else
- FileList["benchmark/{,*/**/}*.yml"]
- end
- cd(base_dir) do
- benchmarks.each do |benchmark|
- sh("benchmark-driver", benchmark)
- end
- end
-end
-
-YARD::Rake::YardocTask.new do |task|
-end
diff --git a/ruby/red-arrow/benchmark/raw-records/boolean.yml b/ruby/red-arrow/benchmark/raw-records/boolean.yml
deleted file mode 100644
index 5e2551e..0000000
--- a/ruby/red-arrow/benchmark/raw-records/boolean.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = :boolean
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map { Faker::Boolean.boolean }
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j][i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/raw-records/decimal128.yml b/ruby/red-arrow/benchmark/raw-records/decimal128.yml
deleted file mode 100644
index 367e7c7..0000000
--- a/ruby/red-arrow/benchmark/raw-records/decimal128.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = Arrow::Decimal128DataType.new(10, 5)
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map do
- Faker::Number.decimal(l_digits: 10, r_digits: 5)
- end
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- x = columns[j][i]
- record << BigDecimal(x.to_s)
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records()
diff --git a/ruby/red-arrow/benchmark/raw-records/dictionary.yml b/ruby/red-arrow/benchmark/raw-records/dictionary.yml
deleted file mode 100644
index 151bb41..0000000
--- a/ruby/red-arrow/benchmark/raw-records/dictionary.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = Arrow::DictionaryDataType.new(:int8, :string, true)
-
- fields = n_columns.times.map {|i| ["column_#{i}".to_sym, type] }.to_h
- schema = Arrow::Schema.new(**fields)
- dictionary = Arrow::StringArray.new(
- 100.times.map { Faker::Book.genre }.uniq.sort
- )
- indices = Arrow::Int8Array.new(
- n_rows.times.map {
- Faker::Number.within(range: 0 ... dictionary.length)
- }
- )
- arrays = n_columns.times.map do
- Arrow::DictionaryArray.new(
- type,
- indices,
- dictionary,
- )
- end
- record_batch = Arrow::RecordBatch.new(schema, n_rows, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j].data.indices[i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/raw-records/int64.yml b/ruby/red-arrow/benchmark/raw-records/int64.yml
deleted file mode 100644
index bd03ab9..0000000
--- a/ruby/red-arrow/benchmark/raw-records/int64.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = :int64
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map do
- Faker::Number.number(digits: 18).to_i
- end
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j][i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/raw-records/list.yml b/ruby/red-arrow/benchmark/raw-records/list.yml
deleted file mode 100644
index b9a5267..0000000
--- a/ruby/red-arrow/benchmark/raw-records/list.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = Arrow::ListDataType.new(name: "values", type: :double)
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map do
- n_elements = Faker::Number.within(range: 1 ... 100)
- n_elements.times.map do
- Faker::Number.normal(mean: 0, standard_deviation: 1e+6)
- end
- end
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j][i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/raw-records/string.yml b/ruby/red-arrow/benchmark/raw-records/string.yml
deleted file mode 100644
index 2854a37..0000000
--- a/ruby/red-arrow/benchmark/raw-records/string.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = :string
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map { Faker::Name.name }
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j][i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/raw-records/timestamp.yml b/ruby/red-arrow/benchmark/raw-records/timestamp.yml
deleted file mode 100644
index 9b65b79..0000000
--- a/ruby/red-arrow/benchmark/raw-records/timestamp.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_rows = 1000
- n_columns = 10
- type = Arrow::TimestampDataType.new(:micro)
- base_timestamp = Time.at(Faker::Number.within(range: 0 ... 1_000_000_000))
- thirty_days_in_sec = 30*24*3600
- timestamp_range = {
- from: base_timestamp - thirty_days_in_sec,
- to: base_timestamp + thirty_days_in_sec,
- }
-
- fields = {}
- arrays = {}
- n_columns.times do |i|
- column_name = "column_#{i}"
- fields[column_name] = type
- arrays[column_name] = n_rows.times.map do
- sec = Faker::Time.between(timestamp_range).to_i
- micro = Faker::Number.within(range: 0 ... 1_000_000)
- sec * 1_000_000 + micro
- end
- end
- record_batch = Arrow::RecordBatch.new(fields, arrays)
-
- def pure_ruby_raw_records(record_batch)
- n_rows = record_batch.n_rows
- n_columns = record_batch.n_columns
- columns = record_batch.columns
- records = []
- i = 0
- while i < n_rows
- record = []
- j = 0
- while j < n_columns
- record << columns[j][i]
- j += 1
- end
- records << record
- i += 1
- end
- records
- end
-benchmark:
- pure_ruby: |-
- pure_ruby_raw_records(record_batch)
- raw_records: |-
- record_batch.raw_records
diff --git a/ruby/red-arrow/benchmark/values/boolean.yml b/ruby/red-arrow/benchmark/values/boolean.yml
deleted file mode 100644
index 45abff5..0000000
--- a/ruby/red-arrow/benchmark/values/boolean.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- values = n_values.times.map { Faker::Boolean.boolean }
- array = Arrow::BooleanArray.new(values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/decimal128.yml b/ruby/red-arrow/benchmark/values/decimal128.yml
deleted file mode 100644
index 4a2a5bf..0000000
--- a/ruby/red-arrow/benchmark/values/decimal128.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- type = Arrow::Decimal128DataType.new(10, 5)
- values = n_values.times.map { Faker::Number.decimal(l_digits: 10, r_digits: 5) }
- array = Arrow::Decimal128Array.new(type, values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/dictionary.yml b/ruby/red-arrow/benchmark/values/dictionary.yml
deleted file mode 100644
index 5b4f20d..0000000
--- a/ruby/red-arrow/benchmark/values/dictionary.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- type = Arrow::DictionaryDataType.new(:int8, :string, true)
-
- dictionary = Arrow::StringArray.new(
- 100.times.map { Faker::Book.genre }.uniq.sort
- )
- indices = Arrow::Int8Array.new(
- n_values.times.map {
- Faker::Number.within(range: 0 ... dictionary.length)
- }
- )
- array = Arrow::DictionaryArray.new(type, indices, dictionary)
-benchmark:
- pure_ruby: |-
- array.length.times.collect {|i| array.indices[i]}
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/int64.yml b/ruby/red-arrow/benchmark/values/int64.yml
deleted file mode 100644
index d9e8926..0000000
--- a/ruby/red-arrow/benchmark/values/int64.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- values = n_values.times.map { Faker::Number.number(digits: 18).to_i }
- array = Arrow::Int64Array.new(values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/list.yml b/ruby/red-arrow/benchmark/values/list.yml
deleted file mode 100644
index 2764c1a..0000000
--- a/ruby/red-arrow/benchmark/values/list.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- type = Arrow::ListDataType.new(name: "values", type: :double)
-
- values = n_values.times.map do
- n_elements = Faker::Number.within(range: 1 ... 100)
- n_elements.times.map do
- Faker::Number.normal(mean: 0, standard_deviation: 1e+6)
- end
- end
- array = Arrow::ListArray.new(type, values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/string.yml b/ruby/red-arrow/benchmark/values/string.yml
deleted file mode 100644
index 8a40dea..0000000
--- a/ruby/red-arrow/benchmark/values/string.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
-
- values = n_values.times.map { Faker::Name.name }
- array = Arrow::StringArray.new(values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/benchmark/values/timestamp.yml b/ruby/red-arrow/benchmark/values/timestamp.yml
deleted file mode 100644
index 4af46d1..0000000
--- a/ruby/red-arrow/benchmark/values/timestamp.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-contexts:
- - name: master
- prelude: |
- $LOAD_PATH.unshift(File.expand_path("ext/arrow"))
- $LOAD_PATH.unshift(File.expand_path("lib"))
-prelude: |-
- require "arrow"
- require "faker"
-
- state = ENV.fetch("FAKER_RANDOM_SEED", 17).to_i
- Faker::Config.random = Random.new(state)
-
- n_values = 1000
- type = Arrow::TimestampDataType.new(:micro)
- base_timestamp = Time.at(Faker::Number.within(range: 0 ... 1_000_000_000))
- thirty_days_in_sec = 30*24*3600
- timestamp_range = {
- from: base_timestamp - thirty_days_in_sec,
- to: base_timestamp + thirty_days_in_sec,
- }
-
- values = n_values.times.map do
- sec = Faker::Time.between(timestamp_range).to_i
- micro = Faker::Number.within(range: 0 ... 1_000_000)
- sec * 1_000_000 + micro
- end
- array = Arrow::TimestampArray.new(type, values)
-benchmark:
- pure_ruby: |-
- array.collect.to_a
- values: |-
- array.values
diff --git a/ruby/red-arrow/doc/text/development.md b/ruby/red-arrow/doc/text/development.md
deleted file mode 100644
index cc86de3..0000000
--- a/ruby/red-arrow/doc/text/development.md
+++ /dev/null
@@ -1,34 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Development
-
-## Naming convention
-
-### Reader and Writer
-
-Reader and Writer require an opened IO stream.
-
-### Loader and Saver
-
-Loader and Saver require a path. They are convenient classes.
-
-Loader opens the path and reads data by Reader.
-
-Writer opens the path and writes data by Writer.
diff --git a/ruby/red-arrow/example/read-file.rb b/ruby/red-arrow/example/read-file.rb
deleted file mode 100755
index 9a99d33..0000000
--- a/ruby/red-arrow/example/read-file.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-Arrow::MemoryMappedInputStream.open("/tmp/file.arrow") do |input|
- reader = Arrow::RecordBatchFileReader.new(input)
- fields = reader.schema.fields
- reader.each_with_index do |record_batch, i|
- puts("=" * 40)
- puts("record-batch[#{i}]:")
- fields.each do |field|
- field_name = field.name
- values = record_batch.collect do |record|
- record[field_name]
- end
- puts(" #{field_name}: #{values.inspect}")
- end
- end
-end
diff --git a/ruby/red-arrow/example/read-stream.rb b/ruby/red-arrow/example/read-stream.rb
deleted file mode 100755
index c719712..0000000
--- a/ruby/red-arrow/example/read-stream.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-Arrow::MemoryMappedInputStream.open("/tmp/stream.arrow") do |input|
- reader = Arrow::RecordBatchStreamReader.new(input)
- fields = reader.schema.fields
- reader.each_with_index do |record_batch, i|
- puts("=" * 40)
- puts("record-batch[#{i}]:")
- fields.each do |field|
- field_name = field.name
- values = record_batch.collect do |record|
- record[field_name]
- end
- puts(" #{field_name}: #{values.inspect}")
- end
- end
-end
diff --git a/ruby/red-arrow/example/write-file.rb b/ruby/red-arrow/example/write-file.rb
deleted file mode 100755
index c55ab2e..0000000
--- a/ruby/red-arrow/example/write-file.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-fields = [
- Arrow::Field.new("uint8", :uint8),
- Arrow::Field.new("uint16", :uint16),
- Arrow::Field.new("uint32", :uint32),
- Arrow::Field.new("uint64", :uint64),
- Arrow::Field.new("int8", :int8),
- Arrow::Field.new("int16", :int16),
- Arrow::Field.new("int32", :int32),
- Arrow::Field.new("int64", :int64),
- Arrow::Field.new("float", :float),
- Arrow::Field.new("double", :double),
-]
-schema = Arrow::Schema.new(fields)
-
-Arrow::FileOutputStream.open("/tmp/file.arrow", false) do |output|
- Arrow::RecordBatchFileWriter.open(output, schema) do |writer|
- uints = [1, 2, 4, 8]
- ints = [1, -2, 4, -8]
- floats = [1.1, -2.2, 4.4, -8.8]
- columns = [
- Arrow::UInt8Array.new(uints),
- Arrow::UInt16Array.new(uints),
- Arrow::UInt32Array.new(uints),
- Arrow::UInt64Array.new(uints),
- Arrow::Int8Array.new(ints),
- Arrow::Int16Array.new(ints),
- Arrow::Int32Array.new(ints),
- Arrow::Int64Array.new(ints),
- Arrow::FloatArray.new(floats),
- Arrow::DoubleArray.new(floats),
- ]
-
- record_batch = Arrow::RecordBatch.new(schema, 4, columns)
- writer.write_record_batch(record_batch)
-
- sliced_columns = columns.collect do |column|
- column.slice(1, 3)
- end
- record_batch = Arrow::RecordBatch.new(schema, 3, sliced_columns)
- writer.write_record_batch(record_batch)
- end
-end
diff --git a/ruby/red-arrow/example/write-stream.rb b/ruby/red-arrow/example/write-stream.rb
deleted file mode 100755
index fde4862..0000000
--- a/ruby/red-arrow/example/write-stream.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow"
-
-fields = [
- Arrow::Field.new("uint8", :uint8),
- Arrow::Field.new("uint16", :uint16),
- Arrow::Field.new("uint32", :uint32),
- Arrow::Field.new("uint64", :uint64),
- Arrow::Field.new("int8", :int8),
- Arrow::Field.new("int16", :int16),
- Arrow::Field.new("int32", :int32),
- Arrow::Field.new("int64", :int64),
- Arrow::Field.new("float", :float),
- Arrow::Field.new("double", :double),
-]
-schema = Arrow::Schema.new(fields)
-
-Arrow::FileOutputStream.open("/tmp/stream.arrow", false) do |output|
- Arrow::RecordBatchStreamWriter.open(output, schema) do |writer|
- uints = [1, 2, 4, 8]
- ints = [1, -2, 4, -8]
- floats = [1.1, -2.2, 4.4, -8.8]
- columns = [
- Arrow::UInt8Array.new(uints),
- Arrow::UInt16Array.new(uints),
- Arrow::UInt32Array.new(uints),
- Arrow::UInt64Array.new(uints),
- Arrow::Int8Array.new(ints),
- Arrow::Int16Array.new(ints),
- Arrow::Int32Array.new(ints),
- Arrow::Int64Array.new(ints),
- Arrow::FloatArray.new(floats),
- Arrow::DoubleArray.new(floats),
- ]
-
- record_batch = Arrow::RecordBatch.new(schema, 4, columns)
- writer.write_record_batch(record_batch)
-
- sliced_columns = columns.collect do |column|
- column.slice(1, 3)
- end
- record_batch = Arrow::RecordBatch.new(schema, 3, sliced_columns)
- writer.write_record_batch(record_batch)
- end
-end
diff --git a/ruby/red-arrow/ext/arrow/arrow.cpp b/ruby/red-arrow/ext/arrow/arrow.cpp
deleted file mode 100644
index 6226ba0..0000000
--- a/ruby/red-arrow/ext/arrow/arrow.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "red-arrow.hpp"
-
-#include <ruby.hpp>
-
-namespace red_arrow {
- VALUE cDate;
-
- VALUE cArrowTime;
-
- VALUE ArrowTimeUnitSECOND;
- VALUE ArrowTimeUnitMILLI;
- VALUE ArrowTimeUnitMICRO;
- VALUE ArrowTimeUnitNANO;
-
- ID id_BigDecimal;
- ID id_jd;
- ID id_new;
- ID id_to_datetime;
-}
-
-extern "C" void Init_arrow() {
- auto mArrow = rb_const_get_at(rb_cObject, rb_intern("Arrow"));
-
- auto cArrowArray = rb_const_get_at(mArrow, rb_intern("Array"));
- rb_define_method(cArrowArray, "values",
- reinterpret_cast<rb::RawMethod>(red_arrow::array_values),
- 0);
-
- auto cArrowChunkedArray = rb_const_get_at(mArrow, rb_intern("ChunkedArray"));
- rb_define_method(cArrowChunkedArray, "values",
- reinterpret_cast<rb::RawMethod>(red_arrow::chunked_array_values),
- 0);
-
- auto cArrowRecordBatch = rb_const_get_at(mArrow, rb_intern("RecordBatch"));
- rb_define_method(cArrowRecordBatch, "raw_records",
- reinterpret_cast<rb::RawMethod>(red_arrow::record_batch_raw_records),
- 0);
-
- auto cArrowTable = rb_const_get_at(mArrow, rb_intern("Table"));
- rb_define_method(cArrowTable, "raw_records",
- reinterpret_cast<rb::RawMethod>(red_arrow::table_raw_records),
- 0);
-
- red_arrow::cDate = rb_const_get(rb_cObject, rb_intern("Date"));
-
- red_arrow::cArrowTime = rb_const_get_at(mArrow, rb_intern("Time"));
-
- auto cArrowTimeUnit = rb_const_get_at(mArrow, rb_intern("TimeUnit"));
- red_arrow::ArrowTimeUnitSECOND =
- rb_const_get_at(cArrowTimeUnit, rb_intern("SECOND"));
- red_arrow::ArrowTimeUnitMILLI =
- rb_const_get_at(cArrowTimeUnit, rb_intern("MILLI"));
- red_arrow::ArrowTimeUnitMICRO =
- rb_const_get_at(cArrowTimeUnit, rb_intern("MICRO"));
- red_arrow::ArrowTimeUnitNANO =
- rb_const_get_at(cArrowTimeUnit, rb_intern("NANO"));
-
- red_arrow::id_BigDecimal = rb_intern("BigDecimal");
- red_arrow::id_jd = rb_intern("jd");
- red_arrow::id_new = rb_intern("new");
- red_arrow::id_to_datetime = rb_intern("to_datetime");
-}
diff --git a/ruby/red-arrow/ext/arrow/converters.cpp b/ruby/red-arrow/ext/arrow/converters.cpp
deleted file mode 100644
index 12e8324..0000000
--- a/ruby/red-arrow/ext/arrow/converters.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "converters.hpp"
-
-namespace red_arrow {
- VALUE ArrayValueConverter::convert(const arrow::ListArray& array,
- const int64_t i) {
- return list_array_value_converter_->convert(array, i);
- }
-
- VALUE ArrayValueConverter::convert(const arrow::StructArray& array,
- const int64_t i) {
- return struct_array_value_converter_->convert(array, i);
- }
-
- VALUE ArrayValueConverter::convert(const arrow::UnionArray& array,
- const int64_t i) {
- return union_array_value_converter_->convert(array, i);
- }
-
- VALUE ArrayValueConverter::convert(const arrow::DictionaryArray& array,
- const int64_t i) {
- return dictionary_array_value_converter_->convert(array, i);
- }
-}
diff --git a/ruby/red-arrow/ext/arrow/converters.hpp b/ruby/red-arrow/ext/arrow/converters.hpp
deleted file mode 100644
index 82d4b55..0000000
--- a/ruby/red-arrow/ext/arrow/converters.hpp
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "red-arrow.hpp"
-
-#include <ruby.hpp>
-#include <ruby/encoding.h>
-
-#include <arrow-glib/error.hpp>
-
-#include <arrow/util/logging.h>
-
-namespace red_arrow {
- class ListArrayValueConverter;
- class StructArrayValueConverter;
- class UnionArrayValueConverter;
- class DictionaryArrayValueConverter;
-
- class ArrayValueConverter {
- public:
- ArrayValueConverter()
- : decimal_buffer_(),
- list_array_value_converter_(nullptr),
- struct_array_value_converter_(nullptr),
- union_array_value_converter_(nullptr),
- dictionary_array_value_converter_(nullptr) {
- }
-
- inline void set_sub_value_converters(ListArrayValueConverter* list_array_value_converter,
- StructArrayValueConverter* struct_array_value_converter,
- UnionArrayValueConverter* union_array_value_converter,
- DictionaryArrayValueConverter* dictionary_array_value_converter) {
- list_array_value_converter_ = list_array_value_converter;
- struct_array_value_converter_ = struct_array_value_converter;
- union_array_value_converter_ = union_array_value_converter;
- dictionary_array_value_converter_ = dictionary_array_value_converter;
- }
-
- inline VALUE convert(const arrow::NullArray& array,
- const int64_t i) {
- return Qnil;
- }
-
- inline VALUE convert(const arrow::BooleanArray& array,
- const int64_t i) {
- return array.Value(i) ? Qtrue : Qfalse;
- }
-
- inline VALUE convert(const arrow::Int8Array& array,
- const int64_t i) {
- return INT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::Int16Array& array,
- const int64_t i) {
- return INT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::Int32Array& array,
- const int64_t i) {
- return INT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::Int64Array& array,
- const int64_t i) {
- return LL2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::UInt8Array& array,
- const int64_t i) {
- return UINT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::UInt16Array& array,
- const int64_t i) {
- return UINT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::UInt32Array& array,
- const int64_t i) {
- return UINT2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::UInt64Array& array,
- const int64_t i) {
- return ULL2NUM(array.Value(i));
- }
-
- // TODO
- // inline VALUE convert(const arrow::HalfFloatArray& array,
- // const int64_t i) {
- // }
-
- inline VALUE convert(const arrow::FloatArray& array,
- const int64_t i) {
- return DBL2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::DoubleArray& array,
- const int64_t i) {
- return DBL2NUM(array.Value(i));
- }
-
- inline VALUE convert(const arrow::BinaryArray& array,
- const int64_t i) {
- int32_t length;
- const auto value = array.GetValue(i, &length);
- // TODO: encoding support
- return rb_enc_str_new(reinterpret_cast<const char*>(value),
- length,
- rb_ascii8bit_encoding());
- }
-
- inline VALUE convert(const arrow::StringArray& array,
- const int64_t i) {
- int32_t length;
- const auto value = array.GetValue(i, &length);
- return rb_utf8_str_new(reinterpret_cast<const char*>(value),
- length);
- }
-
- inline VALUE convert(const arrow::FixedSizeBinaryArray& array,
- const int64_t i) {
- return rb_enc_str_new(reinterpret_cast<const char*>(array.Value(i)),
- array.byte_width(),
- rb_ascii8bit_encoding());
- }
-
- constexpr static int32_t JULIAN_DATE_UNIX_EPOCH = 2440588;
- inline VALUE convert(const arrow::Date32Array& array,
- const int64_t i) {
- const auto value = array.Value(i);
- const auto days_in_julian = value + JULIAN_DATE_UNIX_EPOCH;
- return rb_funcall(cDate, id_jd, 1, LONG2NUM(days_in_julian));
- }
-
- inline VALUE convert(const arrow::Date64Array& array,
- const int64_t i) {
- const auto value = array.Value(i);
- auto msec = LL2NUM(value);
- auto sec = rb_rational_new(msec, INT2NUM(1000));
- auto time_value = rb_time_num_new(sec, Qnil);
- return rb_funcall(time_value, id_to_datetime, 0, 0);
- }
-
- inline VALUE convert(const arrow::Time32Array& array,
- const int64_t i) {
- const auto type =
- arrow::internal::checked_cast<const arrow::Time32Type*>(array.type().get());
- const auto value = array.Value(i);
- return rb_funcall(red_arrow::cArrowTime,
- id_new,
- 2,
- time_unit_to_enum(type->unit()),
- INT2NUM(value));
- }
-
- inline VALUE convert(const arrow::Time64Array& array,
- const int64_t i) {
- const auto type =
- arrow::internal::checked_cast<const arrow::Time64Type*>(array.type().get());
- const auto value = array.Value(i);
- return rb_funcall(red_arrow::cArrowTime,
- id_new,
- 2,
- time_unit_to_enum(type->unit()),
- LL2NUM(value));
- }
-
- inline VALUE convert(const arrow::TimestampArray& array,
- const int64_t i) {
- const auto type =
- arrow::internal::checked_cast<const arrow::TimestampType*>(array.type().get());
- auto scale = time_unit_to_scale(type->unit());
- auto value = array.Value(i);
- auto sec = rb_rational_new(LL2NUM(value), scale);
- return rb_time_num_new(sec, Qnil);
- }
-
- // TODO
- // inline VALUE convert(const arrow::IntervalArray& array,
- // const int64_t i) {
- // };
-
- VALUE convert(const arrow::ListArray& array,
- const int64_t i);
-
- VALUE convert(const arrow::StructArray& array,
- const int64_t i);
-
- VALUE convert(const arrow::UnionArray& array,
- const int64_t i);
-
- VALUE convert(const arrow::DictionaryArray& array,
- const int64_t i);
-
- inline VALUE convert(const arrow::Decimal128Array& array,
- const int64_t i) {
- return convert_decimal(std::move(array.FormatValue(i)));
- }
-
- inline VALUE convert(const arrow::Decimal256Array& array,
- const int64_t i) {
- return convert_decimal(std::move(array.FormatValue(i)));
- }
-
- private:
- inline VALUE convert_decimal(std::string&& value) {
- decimal_buffer_ = value;
- return rb_funcall(rb_cObject,
- id_BigDecimal,
- 1,
- rb_enc_str_new(decimal_buffer_.data(),
- decimal_buffer_.length(),
- rb_ascii8bit_encoding()));
- }
-
- std::string decimal_buffer_;
- ListArrayValueConverter* list_array_value_converter_;
- StructArrayValueConverter* struct_array_value_converter_;
- UnionArrayValueConverter* union_array_value_converter_;
- DictionaryArrayValueConverter* dictionary_array_value_converter_;
- };
-
- class ListArrayValueConverter : public arrow::ArrayVisitor {
- public:
- explicit ListArrayValueConverter(ArrayValueConverter* converter)
- : array_value_converter_(converter),
- offset_(0),
- length_(0),
- result_(Qnil) {}
-
- VALUE convert(const arrow::ListArray& array, const int64_t index) {
- auto values = array.values().get();
- auto offset_keep = offset_;
- auto length_keep = length_;
- offset_ = array.value_offset(index);
- length_ = array.value_length(index);
- auto result_keep = result_;
- result_ = rb_ary_new_capa(length_);
- check_status(values->Accept(this),
- "[raw-records][list-array]");
- offset_ = offset_keep;
- length_ = length_keep;
- auto result_return = result_;
- result_ = result_keep;
- return result_return;
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- return visit_value(array); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- inline VALUE convert_value(const ArrayType& array,
- const int64_t i) {
- return array_value_converter_->convert(array, i);
- }
-
- template <typename ArrayType>
- arrow::Status visit_value(const ArrayType& array) {
- if (array.null_count() > 0) {
- for (int64_t i = 0; i < length_; ++i) {
- auto value = Qnil;
- if (!array.IsNull(i + offset_)) {
- value = convert_value(array, i + offset_);
- }
- rb_ary_push(result_, value);
- }
- } else {
- for (int64_t i = 0; i < length_; ++i) {
- rb_ary_push(result_, convert_value(array, i + offset_));
- }
- }
- return arrow::Status::OK();
- }
-
- ArrayValueConverter* array_value_converter_;
- int32_t offset_;
- int32_t length_;
- VALUE result_;
- };
-
- class StructArrayValueConverter : public arrow::ArrayVisitor {
- public:
- explicit StructArrayValueConverter(ArrayValueConverter* converter)
- : array_value_converter_(converter),
- key_(Qnil),
- index_(0),
- result_(Qnil) {}
-
- VALUE convert(const arrow::StructArray& array,
- const int64_t index) {
- auto index_keep = index_;
- auto result_keep = result_;
- index_ = index;
- result_ = rb_hash_new();
- const auto struct_type = array.struct_type();
- const auto n = struct_type->num_fields();
- for (int i = 0; i < n; ++i) {
- const auto field_type = struct_type->field(i).get();
- const auto& field_name = field_type->name();
- auto key_keep = key_;
- key_ = rb_utf8_str_new(field_name.data(), field_name.length());
- const auto field_array = array.field(i).get();
- check_status(field_array->Accept(this),
- "[raw-records][struct-array]");
- key_ = key_keep;
- }
- auto result_return = result_;
- result_ = result_keep;
- index_ = index_keep;
- return result_return;
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- fill_field(array); \
- return arrow::Status::OK(); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- inline VALUE convert_value(const ArrayType& array,
- const int64_t i) {
- return array_value_converter_->convert(array, i);
- }
-
- template <typename ArrayType>
- void fill_field(const ArrayType& array) {
- if (array.IsNull(index_)) {
- rb_hash_aset(result_, key_, Qnil);
- } else {
- rb_hash_aset(result_, key_, convert_value(array, index_));
- }
- }
-
- ArrayValueConverter* array_value_converter_;
- VALUE key_;
- int64_t index_;
- VALUE result_;
- };
-
- class UnionArrayValueConverter : public arrow::ArrayVisitor {
- public:
- explicit UnionArrayValueConverter(ArrayValueConverter* converter)
- : array_value_converter_(converter),
- index_(0),
- result_(Qnil) {}
-
- VALUE convert(const arrow::UnionArray& array,
- const int64_t index) {
- const auto index_keep = index_;
- const auto result_keep = result_;
- index_ = index;
- switch (array.mode()) {
- case arrow::UnionMode::SPARSE:
- convert_sparse(static_cast<const arrow::SparseUnionArray&>(array));
- break;
- case arrow::UnionMode::DENSE:
- convert_dense(static_cast<const arrow::DenseUnionArray&>(array));
- break;
- default:
- rb_raise(rb_eArgError, "Invalid union mode");
- break;
- }
- auto result_return = result_;
- index_ = index_keep;
- result_ = result_keep;
- return result_return;
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- convert_value(array); \
- return arrow::Status::OK(); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- inline void convert_value(const ArrayType& array) {
- auto result = rb_hash_new();
- if (array.IsNull(index_)) {
- rb_hash_aset(result, field_name_, Qnil);
- } else {
- rb_hash_aset(result,
- field_name_,
- array_value_converter_->convert(array, index_));
- }
- result_ = result;
- }
-
- uint8_t compute_field_index(const arrow::UnionArray& array,
- arrow::UnionType* type,
- const char* tag) {
- const auto type_code = array.raw_type_codes()[index_];
- if (type_code >= 0 && type_code <= arrow::UnionType::kMaxTypeCode) {
- const auto field_id = type->child_ids()[type_code];
- if (field_id >= 0) {
- return field_id;
- }
- }
- check_status(arrow::Status::Invalid("Unknown type ID: ", type_code),
- tag);
- return 0;
- }
-
- void convert_sparse(const arrow::SparseUnionArray& array) {
- const auto type =
- std::static_pointer_cast<arrow::UnionType>(array.type()).get();
- const auto tag = "[raw-records][union-sparse-array]";
- const auto index = compute_field_index(array, type, tag);
- const auto field = type->field(index).get();
- const auto& field_name = field->name();
- const auto field_name_keep = field_name_;
- field_name_ = rb_utf8_str_new(field_name.data(), field_name.length());
- const auto field_array = array.field(index).get();
- check_status(field_array->Accept(this), tag);
- field_name_ = field_name_keep;
- }
-
- void convert_dense(const arrow::DenseUnionArray& array) {
- const auto type =
- std::static_pointer_cast<arrow::UnionType>(array.type()).get();
- const auto tag = "[raw-records][union-dense-array]";
- const auto index = compute_field_index(array, type, tag);
- const auto field = type->field(index).get();
- const auto& field_name = field->name();
- const auto field_name_keep = field_name_;
- field_name_ = rb_utf8_str_new(field_name.data(), field_name.length());
- const auto field_array = array.field(index);
- const auto index_keep = index_;
- index_ = array.value_offset(index_);
- check_status(field_array->Accept(this), tag);
- index_ = index_keep;
- field_name_ = field_name_keep;
- }
-
- ArrayValueConverter* array_value_converter_;
- int64_t index_;
- VALUE field_name_;
- VALUE result_;
- };
-
- class DictionaryArrayValueConverter : public arrow::ArrayVisitor {
- public:
- explicit DictionaryArrayValueConverter(ArrayValueConverter* converter)
- : array_value_converter_(converter),
- value_index_(0),
- result_(Qnil) {
- }
-
- VALUE convert(const arrow::DictionaryArray& array,
- const int64_t index) {
- value_index_ = array.GetValueIndex(index);
- auto dictionary = array.dictionary().get();
- check_status(dictionary->Accept(this),
- "[raw-records][dictionary-array]");
- return result_;
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- result_ = convert_value(array, value_index_); \
- return arrow::Status::OK(); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- inline VALUE convert_value(const ArrayType& array,
- const int64_t i) {
- return array_value_converter_->convert(array, i);
- }
-
- ArrayValueConverter* array_value_converter_;
- int64_t value_index_;
- VALUE result_;
- };
-
- class Converter {
- public:
- explicit Converter()
- : array_value_converter_(),
- list_array_value_converter_(&array_value_converter_),
- struct_array_value_converter_(&array_value_converter_),
- union_array_value_converter_(&array_value_converter_),
- dictionary_array_value_converter_(&array_value_converter_) {
- array_value_converter_.
- set_sub_value_converters(&list_array_value_converter_,
- &struct_array_value_converter_,
- &union_array_value_converter_,
- &dictionary_array_value_converter_);
- }
-
- template <typename ArrayType>
- inline VALUE convert_value(const ArrayType& array,
- const int64_t i) {
- return array_value_converter_.convert(array, i);
- }
-
- ArrayValueConverter array_value_converter_;
- ListArrayValueConverter list_array_value_converter_;
- StructArrayValueConverter struct_array_value_converter_;
- UnionArrayValueConverter union_array_value_converter_;
- DictionaryArrayValueConverter dictionary_array_value_converter_;
- };
-}
diff --git a/ruby/red-arrow/ext/arrow/extconf.rb b/ruby/red-arrow/ext/arrow/extconf.rb
deleted file mode 100644
index 5ba9f4c..0000000
--- a/ruby/red-arrow/ext/arrow/extconf.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "extpp"
-require "mkmf-gnome"
-require_relative "../../lib/arrow/version"
-
-arrow_pkg_config_path = ENV["ARROW_PKG_CONFIG_PATH"]
-if arrow_pkg_config_path
- pkg_config_paths = [arrow_pkg_config_path, ENV["PKG_CONFIG_PATH"]].compact
- ENV["PKG_CONFIG_PATH"] = pkg_config_paths.join(File::PATH_SEPARATOR)
-end
-
-unless required_pkg_config_package([
- "arrow",
- Arrow::Version::MAJOR,
- Arrow::Version::MINOR,
- Arrow::Version::MICRO,
- ],
- debian: "libarrow-dev",
- redhat: "arrow-devel",
- homebrew: "apache-arrow",
- msys2: "arrow")
- exit(false)
-end
-
-unless required_pkg_config_package([
- "arrow-glib",
- Arrow::Version::MAJOR,
- Arrow::Version::MINOR,
- Arrow::Version::MICRO,
- ],
- debian: "libarrow-glib-dev",
- redhat: "arrow-glib-devel",
- homebrew: "apache-arrow-glib",
- msys2: "arrow")
- exit(false)
-end
-
-[
- ["glib2", "ext/glib2"],
-].each do |name, relative_source_dir|
- spec = find_gem_spec(name)
- source_dir = File.join(spec.full_gem_path, relative_source_dir)
- build_dir = source_dir
- add_depend_package_path(name, source_dir, build_dir)
-end
-
-create_makefile("arrow")
diff --git a/ruby/red-arrow/ext/arrow/raw-records.cpp b/ruby/red-arrow/ext/arrow/raw-records.cpp
deleted file mode 100644
index ef9353e..0000000
--- a/ruby/red-arrow/ext/arrow/raw-records.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "converters.hpp"
-
-namespace red_arrow {
- namespace {
- class RawRecordsBuilder : private Converter, public arrow::ArrayVisitor {
- public:
- explicit RawRecordsBuilder(VALUE records, int n_columns)
- : Converter(),
- records_(records),
- n_columns_(n_columns) {
- }
-
- void build(const arrow::RecordBatch& record_batch) {
- rb::protect([&] {
- const auto n_rows = record_batch.num_rows();
- for (int64_t i = 0; i < n_rows; ++i) {
- auto record = rb_ary_new_capa(n_columns_);
- rb_ary_push(records_, record);
- }
- row_offset_ = 0;
- for (int i = 0; i < n_columns_; ++i) {
- const auto array = record_batch.column(i).get();
- column_index_ = i;
- check_status(array->Accept(this),
- "[record-batch][raw-records]");
- }
- return Qnil;
- });
- }
-
- void build(const arrow::Table& table) {
- rb::protect([&] {
- const auto n_rows = table.num_rows();
- for (int64_t i = 0; i < n_rows; ++i) {
- auto record = rb_ary_new_capa(n_columns_);
- rb_ary_push(records_, record);
- }
- for (int i = 0; i < n_columns_; ++i) {
- const auto& chunked_array = table.column(i).get();
- column_index_ = i;
- row_offset_ = 0;
- for (const auto array : chunked_array->chunks()) {
- check_status(array->Accept(this),
- "[table][raw-records]");
- row_offset_ += array->length();
- }
- }
- return Qnil;
- });
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- convert(array); \
- return arrow::Status::OK(); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- void convert(const ArrayType& array) {
- const auto n = array.length();
- if (array.null_count() > 0) {
- for (int64_t i = 0, ii = row_offset_; i < n; ++i, ++ii) {
- auto value = Qnil;
- if (!array.IsNull(i)) {
- value = convert_value(array, i);
- }
- auto record = rb_ary_entry(records_, ii);
- rb_ary_store(record, column_index_, value);
- }
- } else {
- for (int64_t i = 0, ii = row_offset_; i < n; ++i, ++ii) {
- auto record = rb_ary_entry(records_, ii);
- rb_ary_store(record, column_index_, convert_value(array, i));
- }
- }
- }
-
- // Destination for converted records.
- VALUE records_;
-
- // The current column index.
- int column_index_;
-
- // The current row offset.
- int64_t row_offset_;
-
- // The number of columns.
- const int n_columns_;
- };
- }
-
- VALUE
- record_batch_raw_records(VALUE rb_record_batch) {
- auto garrow_record_batch = GARROW_RECORD_BATCH(RVAL2GOBJ(rb_record_batch));
- auto record_batch = garrow_record_batch_get_raw(garrow_record_batch).get();
- const auto n_rows = record_batch->num_rows();
- const auto n_columns = record_batch->num_columns();
- auto records = rb_ary_new_capa(n_rows);
-
- try {
- RawRecordsBuilder builder(records, n_columns);
- builder.build(*record_batch);
- } catch (rb::State& state) {
- state.jump();
- }
-
- return records;
- }
-
- VALUE
- table_raw_records(VALUE rb_table) {
- auto garrow_table = GARROW_TABLE(RVAL2GOBJ(rb_table));
- auto table = garrow_table_get_raw(garrow_table).get();
- const auto n_rows = table->num_rows();
- const auto n_columns = table->num_columns();
- auto records = rb_ary_new_capa(n_rows);
-
- try {
- RawRecordsBuilder builder(records, n_columns);
- builder.build(*table);
- } catch (rb::State& state) {
- state.jump();
- }
-
- return records;
- }
-}
diff --git a/ruby/red-arrow/ext/arrow/red-arrow.hpp b/ruby/red-arrow/ext/arrow/red-arrow.hpp
deleted file mode 100644
index c3301dc..0000000
--- a/ruby/red-arrow/ext/arrow/red-arrow.hpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#pragma once
-
-#include <arrow/api.h>
-
-#ifdef _WIN32
-# define gmtime_r gmtime_r_ruby_win32
-# define localtime_r localtime_r_ruby_win32
-# include <ruby.h>
-# undef gmtime_r
-# undef localtime_r
-#endif
-
-#include <arrow-glib/arrow-glib.hpp>
-#include <rbgobject.h>
-
-namespace red_arrow {
- extern VALUE cDate;
-
- extern VALUE cArrowTime;
-
- extern VALUE ArrowTimeUnitSECOND;
- extern VALUE ArrowTimeUnitMILLI;
- extern VALUE ArrowTimeUnitMICRO;
- extern VALUE ArrowTimeUnitNANO;
-
- extern ID id_BigDecimal;
- extern ID id_jd;
- extern ID id_new;
- extern ID id_to_datetime;
-
- VALUE array_values(VALUE obj);
- VALUE chunked_array_values(VALUE obj);
-
- VALUE record_batch_raw_records(VALUE obj);
- VALUE table_raw_records(VALUE obj);
-
- inline VALUE time_unit_to_scale(const arrow::TimeUnit::type unit) {
- switch (unit) {
- case arrow::TimeUnit::SECOND:
- return INT2FIX(1);
- case arrow::TimeUnit::MILLI:
- return INT2FIX(1000);
- case arrow::TimeUnit::MICRO:
- return INT2FIX(1000 * 1000);
- case arrow::TimeUnit::NANO:
- // NOTE: INT2FIX works for 1e+9 because: FIXNUM_MAX >= (1<<30) - 1 > 1e+9
- return INT2FIX(1000 * 1000 * 1000);
- default:
- rb_raise(rb_eArgError, "invalid arrow::TimeUnit: %d", unit);
- return Qnil;
- }
- }
-
- inline VALUE time_unit_to_enum(const arrow::TimeUnit::type unit) {
- switch (unit) {
- case arrow::TimeUnit::SECOND:
- return red_arrow::ArrowTimeUnitSECOND;
- case arrow::TimeUnit::MILLI:
- return red_arrow::ArrowTimeUnitMILLI;
- case arrow::TimeUnit::MICRO:
- return red_arrow::ArrowTimeUnitMICRO;
- case arrow::TimeUnit::NANO:
- return red_arrow::ArrowTimeUnitNANO;
- default:
- rb_raise(rb_eArgError, "invalid arrow::TimeUnit: %d", unit);
- return Qnil;
- }
- }
-
- inline void check_status(const arrow::Status&& status, const char* context) {
- GError* error = nullptr;
- if (!garrow_error_check(&error, status, context)) {
- RG_RAISE_ERROR(error);
- }
- }
-}
diff --git a/ruby/red-arrow/ext/arrow/values.cpp b/ruby/red-arrow/ext/arrow/values.cpp
deleted file mode 100644
index 56846ab..0000000
--- a/ruby/red-arrow/ext/arrow/values.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "converters.hpp"
-
-namespace red_arrow {
- namespace {
- class ValuesBuilder : private Converter, public arrow::ArrayVisitor {
- public:
- explicit ValuesBuilder(VALUE values)
- : Converter(),
- values_(values),
- row_offset_(0) {
- }
-
- void build(const arrow::Array& array, VALUE rb_array) {
- rb::protect([&] {
- check_status(array.Accept(this),
- "[array][values]");
- return Qnil;
- });
- }
-
- void build(const arrow::ChunkedArray& chunked_array,
- VALUE rb_chunked_array) {
- rb::protect([&] {
- for (const auto& array : chunked_array.chunks()) {
- check_status(array->Accept(this),
- "[chunked-array][values]");
- row_offset_ += array->length();
- }
- return Qnil;
- });
- }
-
-#define VISIT(TYPE) \
- arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
- convert(array); \
- return arrow::Status::OK(); \
- }
-
- VISIT(Null)
- VISIT(Boolean)
- VISIT(Int8)
- VISIT(Int16)
- VISIT(Int32)
- VISIT(Int64)
- VISIT(UInt8)
- VISIT(UInt16)
- VISIT(UInt32)
- VISIT(UInt64)
- // TODO
- // VISIT(HalfFloat)
- VISIT(Float)
- VISIT(Double)
- VISIT(Binary)
- VISIT(String)
- VISIT(FixedSizeBinary)
- VISIT(Date32)
- VISIT(Date64)
- VISIT(Time32)
- VISIT(Time64)
- VISIT(Timestamp)
- // TODO
- // VISIT(Interval)
- VISIT(List)
- VISIT(Struct)
- VISIT(SparseUnion)
- VISIT(DenseUnion)
- VISIT(Dictionary)
- VISIT(Decimal128)
- VISIT(Decimal256)
- // TODO
- // VISIT(Extension)
-
-#undef VISIT
-
- private:
- template <typename ArrayType>
- void convert(const ArrayType& array) {
- const auto n = array.length();
- if (array.null_count() > 0) {
- for (int64_t i = 0, ii = row_offset_; i < n; ++i, ++ii) {
- auto value = Qnil;
- if (!array.IsNull(i)) {
- value = convert_value(array, i);
- }
- rb_ary_store(values_, ii, value);
- }
- } else {
- for (int64_t i = 0, ii = row_offset_; i < n; ++i, ++ii) {
- rb_ary_store(values_, ii, convert_value(array, i));
- }
- }
- }
-
- // Destination for converted values.
- VALUE values_;
-
- // The current row offset.
- int64_t row_offset_;
- };
- }
-
- VALUE
- array_values(VALUE rb_array) {
- auto garrow_array = GARROW_ARRAY(RVAL2GOBJ(rb_array));
- auto array = garrow_array_get_raw(garrow_array).get();
- const auto n_rows = array->length();
- auto values = rb_ary_new_capa(n_rows);
-
- try {
- ValuesBuilder builder(values);
- builder.build(*array, rb_array);
- } catch (rb::State& state) {
- state.jump();
- }
-
- return values;
- }
-
- VALUE
- chunked_array_values(VALUE rb_chunked_array) {
- auto garrow_chunked_array =
- GARROW_CHUNKED_ARRAY(RVAL2GOBJ(rb_chunked_array));
- auto chunked_array =
- garrow_chunked_array_get_raw(garrow_chunked_array).get();
- const auto n_rows = chunked_array->length();
- auto values = rb_ary_new_capa(n_rows);
-
- try {
- ValuesBuilder builder(values);
- builder.build(*chunked_array, rb_chunked_array);
- } catch (rb::State& state) {
- state.jump();
- }
-
- return values;
- }
-}
diff --git a/ruby/red-arrow/image/red-arrow.png b/ruby/red-arrow/image/red-arrow.png
deleted file mode 100644
index 6db9b4b..0000000
Binary files a/ruby/red-arrow/image/red-arrow.png and /dev/null differ
diff --git a/ruby/red-arrow/lib/arrow.rb b/ruby/red-arrow/lib/arrow.rb
deleted file mode 100644
index 8fbc537..0000000
--- a/ruby/red-arrow/lib/arrow.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "extpp/setup"
-require "gio2"
-
-require "arrow/version"
-
-require "arrow/loader"
-
-module Arrow
- class Error < StandardError
- end
-
- Loader.load
-end
diff --git a/ruby/red-arrow/lib/arrow/array-builder.rb b/ruby/red-arrow/lib/arrow/array-builder.rb
deleted file mode 100644
index 0ce16ca..0000000
--- a/ruby/red-arrow/lib/arrow/array-builder.rb
+++ /dev/null
@@ -1,209 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "date"
-
-module Arrow
- class ArrayBuilder
- class << self
- def build(values)
- if self != ArrayBuilder
- builder = new
- return builder.build(values)
- end
-
- builder_info = nil
- values.each do |value|
- builder_info = detect_builder_info(value, builder_info)
- break if builder_info and builder_info[:detected]
- end
- if builder_info
- builder = builder_info[:builder]
- builder.build(values)
- else
- Arrow::StringArray.new(values)
- end
- end
-
- def buildable?(args)
- args.size == method(:build).arity
- end
-
- private
- def detect_builder_info(value, builder_info)
- case value
- when nil
- builder_info
- when true, false
- {
- builder: BooleanArrayBuilder.new,
- detected: true,
- }
- when String
- {
- builder: StringArrayBuilder.new,
- detected: true,
- }
- when Float
- {
- builder: DoubleArrayBuilder.new,
- detected: true,
- }
- when Integer
- if value < 0
- {
- builder: IntArrayBuilder.new,
- detected: true,
- }
- else
- {
- builder: UIntArrayBuilder.new,
- }
- end
- when Time
- data_type = value.data_type
- case data_type.unit
- when TimeUnit::SECOND
- builder_info || {
- builder: Time32ArrayBuilder.new(data_type)
- }
- when TimeUnit::MILLI
- if builder_info and builder_info[:builder].is_a?(Time64ArrayBuilder)
- builder_info
- else
- {
- builder: Time32ArrayBuilder.new(data_type),
- }
- end
- when TimeUnit::MICRO
- {
- builder: Time64ArrayBuilder.new(data_type),
- }
- when TimeUnit::NANO
- {
- builder: Time64ArrayBuilder.new(data_type),
- detected: true
- }
- end
- when ::Time
- data_type = TimestampDataType.new(:nano)
- {
- builder: TimestampArrayBuilder.new(data_type),
- detected: true,
- }
- when DateTime
- {
- builder: Date64ArrayBuilder.new,
- detected: true,
- }
- when Date
- {
- builder: Date32ArrayBuilder.new,
- detected: true,
- }
- when BigDecimal
- if value.to_arrow.is_a?(Decimal128)
- {
- builder: Decimal128ArrayBuilder.new,
- }
- else
- {
- builder: Decimal256ArrayBuilder.new,
- detected: true,
- }
- end
- when ::Array
- sub_builder_info = nil
- value.each do |sub_value|
- sub_builder_info = detect_builder_info(sub_value, sub_builder_info)
- break if sub_builder_info and sub_builder_info[:detected]
- end
- if sub_builder_info and sub_builder_info[:detected]
- sub_value_data_type = sub_builder_info[:builder].value_data_type
- field = Field.new("item", sub_value_data_type)
- {
- builder: ListArrayBuilder.new(ListDataType.new(field)),
- detected: true,
- }
- else
- builder_info
- end
- else
- {
- builder: StringArrayBuilder.new,
- detected: true,
- }
- end
- end
- end
-
- def build(values)
- append(*values)
- finish
- end
-
- # @since 0.12.0
- def append(*values)
- value_convertable = respond_to?(:convert_to_arrow_value, true)
- start_index = 0
- current_index = 0
- status = :value
-
- values.each do |value|
- if value.nil?
- if status == :value
- if start_index != current_index
- target_values = values[start_index...current_index]
- if value_convertable
- target_values = target_values.collect do |v|
- convert_to_arrow_value(v)
- end
- end
- append_values(target_values, nil)
- start_index = current_index
- end
- status = :null
- end
- else
- if status == :null
- append_nulls(current_index - start_index)
- start_index = current_index
- status = :value
- end
- end
- current_index += 1
- end
- if start_index != current_index
- if status == :value
- if start_index == 0 and current_index == values.size
- target_values = values
- else
- target_values = values[start_index...current_index]
- end
- if value_convertable
- target_values = target_values.collect do |v|
- convert_to_arrow_value(v)
- end
- end
- append_values(target_values, nil)
- else
- append_nulls(current_index - start_index)
- end
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/array.rb b/ruby/red-arrow/lib/arrow/array.rb
deleted file mode 100644
index ae6125d..0000000
--- a/ruby/red-arrow/lib/arrow/array.rb
+++ /dev/null
@@ -1,222 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Array
- include Enumerable
- include GenericFilterable
- include GenericTakeable
-
- class << self
- def new(*args)
- _builder_class = builder_class
- return super if _builder_class.nil?
- return super unless _builder_class.buildable?(args)
- _builder_class.build(*args)
- end
-
- def builder_class
- builder_class_name = "#{name}Builder"
- return nil unless const_defined?(builder_class_name)
- const_get(builder_class_name)
- end
- end
-
- # @param i [Integer]
- # The index of the value to be gotten.
- #
- # You can specify negative index like for `::Array#[]`.
- #
- # @return [Object, nil]
- # The `i`-th value.
- #
- # `nil` for NULL value or out of range `i`.
- def [](i)
- i += length if i < 0
- return nil if i < 0 or i >= length
- if null?(i)
- nil
- else
- get_value(i)
- end
- end
-
- def each
- return to_enum(__method__) unless block_given?
-
- length.times do |i|
- yield(self[i])
- end
- end
-
- def reverse_each
- return to_enum(__method__) unless block_given?
-
- (length - 1).downto(0) do |i|
- yield(self[i])
- end
- end
-
- def to_arrow
- self
- end
-
- alias_method :value_data_type_raw, :value_data_type
- def value_data_type
- @value_data_type ||= value_data_type_raw
- end
-
- def to_a
- values
- end
-
- alias_method :is_in_raw, :is_in
- def is_in(values)
- case values
- when ::Array
- if self.class.builder_class.buildable?([values])
- values = self.class.new(values)
- else
- values = self.class.new(value_data_type, values)
- end
- is_in_raw(values)
- when ChunkedArray
- is_in_chunked_array(values)
- else
- is_in_raw(values)
- end
- end
-
- # @api private
- alias_method :concatenate_raw, :concatenate
- # Concatenates the given other arrays to the array.
- #
- # @param other_arrays [::Array, Arrow::Array] The arrays to be
- # concatenated.
- #
- # Each other array is processed by {#resolve} before they're
- # concatenated.
- #
- # @example Raw Ruby Array
- # array = Arrow::Int32Array.new([1])
- # array.concatenate([2, 3], [4]) # => Arrow::Int32Array.new([1, 2, 3, 4])
- #
- # @example Arrow::Array
- # array = Arrow::Int32Array.new([1])
- # array.concatenate(Arrow::Int32Array.new([2, 3]),
- # Arrow::Int8Array.new([4])) # => Arrow::Int32Array.new([1, 2, 3, 4])
- #
- # @since 4.0.0
- def concatenate(*other_arrays)
- other_arrays = other_arrays.collect do |other_array|
- resolve(other_array)
- end
- concatenate_raw(other_arrays)
- end
-
- # Concatenates the given other array to the array.
- #
- # If you have multiple arrays to be concatenated, you should use
- # {#concatenate} to concatenate multiple arrays at once.
- #
- # @param other_array [::Array, Arrow::Array] The array to be concatenated.
- #
- # `@other_array` is processed by {#resolve} before it's
- # concatenated.
- #
- # @example Raw Ruby Array
- # Arrow::Int32Array.new([1]) + [2, 3] # => Arrow::Int32Array.new([1, 2, 3])
- #
- # @example Arrow::Array
- # Arrow::Int32Array.new([1]) +
- # Arrow::Int32Array.new([2, 3]) # => Arrow::Int32Array.new([1, 2, 3])
- #
- # @since 4.0.0
- def +(other_array)
- concatenate(other_array)
- end
-
- # Ensures returning the same data type array from the given array.
- #
- # @return [Arrow::Array]
- #
- # @overload resolve(other_raw_array)
- #
- # @param other_raw_array [::Array] A raw Ruby Array. A new Arrow::Array
- # is built by `self.class.new`.
- #
- # @example Raw Ruby Array
- # int32_array = Arrow::Int32Array.new([1])
- # other_array = int32_array.resolve([2, 3, 4])
- # other_array # => Arrow::Int32Array.new([2, 3, 4])
- #
- # @overload resolve(other_array)
- #
- # @param other_array [Arrow::Array] Another Arrow::Array.
- #
- # If the given other array is an same data type array of
- # `self`, the given other array is returned as-is.
- #
- # If the given other array isn't an same data type array of
- # `self`, the given other array is casted.
- #
- # @example Same data type
- # int32_array = Arrow::Int32Array.new([1])
- # other_int32_array = Arrow::Int32Array.new([2, 3, 4])
- # other_array = int32_array.resolve(other_int32_array)
- # other_array.object_id == other_int32_array.object_id
- #
- # @example Other data type
- # int32_array = Arrow::Int32Array.new([1])
- # other_int8_array = Arrow::Int8Array.new([2, 3, 4])
- # other_array = int32_array.resolve(other_int32_array)
- # other_array #=> Arrow::Int32Array.new([2, 3, 4])
- #
- # @since 4.0.0
- def resolve(other_array)
- if other_array.is_a?(::Array)
- builder_class = self.class.builder_class
- if builder_class.nil?
- message =
- "[array][resolve] can't build #{value_data_type} array " +
- "from raw Ruby Array"
- raise ArgumentError, message
- end
- if builder_class.buildable?([other_array])
- other_array = builder_class.build(other_array)
- elsif builder_class.buildable?([value_data_type, other_array])
- other_array = builder_class.build(value_data_type, other_array)
- else
- message =
- "[array][resolve] need to implement " +
- "a feature that building #{value_data_type} array " +
- "from raw Ruby Array"
- raise NotImpelemented, message
- end
- other_array
- elsif other_array.respond_to?(:value_data_type)
- return other_array if value_data_type == other_array.value_data_type
- other_array.cast(value_data_type)
- else
- message =
- "[array][resolve] can't build #{value_data_type} array: " +
- "#{other_array.inspect}"
- raise ArgumentError, message
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/bigdecimal-extension.rb b/ruby/red-arrow/lib/arrow/bigdecimal-extension.rb
deleted file mode 100644
index 338efe6..0000000
--- a/ruby/red-arrow/lib/arrow/bigdecimal-extension.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "bigdecimal"
-
-class BigDecimal
- def to_arrow
- if precision <= Arrow::Decimal128DataType::MAX_PRECISION
- Arrow::Decimal128.new(to_s)
- else
- Arrow::Decimal256.new(to_s)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/block-closable.rb b/ruby/red-arrow/lib/arrow/block-closable.rb
deleted file mode 100644
index ec236bd..0000000
--- a/ruby/red-arrow/lib/arrow/block-closable.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module BlockClosable
- def open(*args, &block)
- io = new(*args)
- return io unless block
-
- begin
- yield(io)
- ensure
- if io.respond_to?(:closed?)
- io.close unless io.closed?
- else
- io.close
- end
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/buffer.rb b/ruby/red-arrow/lib/arrow/buffer.rb
deleted file mode 100644
index 1efd797..0000000
--- a/ruby/red-arrow/lib/arrow/buffer.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Buffer
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- def initialize(data)
- @data = data
- initialize_raw(data)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/chunked-array.rb b/ruby/red-arrow/lib/arrow/chunked-array.rb
deleted file mode 100644
index 30dffa8..0000000
--- a/ruby/red-arrow/lib/arrow/chunked-array.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class ChunkedArray
- include Enumerable
- include GenericFilterable
- include GenericTakeable
-
- alias_method :size, :n_rows
- unless method_defined?(:length)
- alias_method :length, :n_rows
- end
-
- alias_method :chunks_raw, :chunks
- def chunks
- @chunks ||= chunks_raw
- end
-
- def null?(i)
- chunks.each do |array|
- return array.null?(i) if i < array.length
- i -= array.length
- end
- nil
- end
-
- def valid?(i)
- chunks.each do |array|
- return array.valid?(i) if i < array.length
- i -= array.length
- end
- nil
- end
-
- def [](i)
- i += length if i < 0
- chunks.each do |array|
- return array[i] if i < array.length
- i -= array.length
- end
- nil
- end
-
- def each(&block)
- return to_enum(__method__) unless block_given?
-
- chunks.each do |array|
- array.each(&block)
- end
- end
-
- def reverse_each(&block)
- return to_enum(__method__) unless block_given?
-
- chunks.reverse_each do |array|
- array.reverse_each(&block)
- end
- end
-
- def each_chunk(&block)
- chunks.each(&block)
- end
-
- def pack
- first_chunk = chunks.first
- data_type = first_chunk.value_data_type
- case data_type
- when TimestampDataType
- builder = TimestampArrayBuilder.new(data_type)
- builder.build(to_a)
- else
- first_chunk.class.new(to_a)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/column-containable.rb b/ruby/red-arrow/lib/arrow/column-containable.rb
deleted file mode 100644
index 51ad88e..0000000
--- a/ruby/red-arrow/lib/arrow/column-containable.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module ColumnContainable
- def columns
- @columns ||= schema.n_fields.times.collect do |i|
- Column.new(self, i)
- end
- end
-
- def each_column(&block)
- columns.each(&block)
- end
-
- def find_column(name_or_index)
- case name_or_index
- when String, Symbol
- name = name_or_index.to_s
- index = schema.get_field_index(name)
- return nil if index == -1
- Column.new(self, index)
- when Integer
- index = name_or_index
- index += n_columns if index < 0
- return nil if index < 0 or index >= n_columns
- Column.new(self, index)
- else
- message = "column name or index must be String, Symbol or Integer"
- raise ArgumentError, message
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/column.rb b/ruby/red-arrow/lib/arrow/column.rb
deleted file mode 100644
index 06f3dbd..0000000
--- a/ruby/red-arrow/lib/arrow/column.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Column
- include Enumerable
-
- attr_reader :container
- attr_reader :field
- attr_reader :data
- def initialize(container, index)
- @container = container
- @index = index
- @field = @container.schema[@index]
- @data = @container.get_column_data(@index)
- end
-
- def name
- @field.name
- end
-
- def data_type
- @field.data_type
- end
-
- def null?(i)
- @data.null?(i)
- end
-
- def valid?(i)
- @data.valid?(i)
- end
-
- def [](i)
- @data[i]
- end
-
- def each(&block)
- @data.each(&block)
- end
-
- def reverse_each(&block)
- @data.reverse_each(&block)
- end
-
- def n_rows
- @data.n_rows
- end
- alias_method :size, :n_rows
- alias_method :length, :n_rows
-
- def n_nulls
- @data.n_nulls
- end
-
- def ==(other)
- other.is_a?(self.class) and
- @field == other.field and
- @data == other.data
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/compression-type.rb b/ruby/red-arrow/lib/arrow/compression-type.rb
deleted file mode 100644
index b913e48..0000000
--- a/ruby/red-arrow/lib/arrow/compression-type.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class CompressionType
- EXTENSIONS = {}
- values.each do |value|
- case value
- when UNCOMPRESSED
- when GZIP
- EXTENSIONS["gz"] = value
- else
- EXTENSIONS[value.nick] = value
- end
- end
-
- class << self
- def resolve_extension(extension)
- EXTENSIONS[extension.to_s]
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/csv-loader.rb b/ruby/red-arrow/lib/arrow/csv-loader.rb
deleted file mode 100644
index f82263e..0000000
--- a/ruby/red-arrow/lib/arrow/csv-loader.rb
+++ /dev/null
@@ -1,384 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "csv"
-require "pathname"
-require "time"
-
-module Arrow
- class CSVLoader
- class << self
- def load(path_or_data, **options)
- new(path_or_data, **options).load
- end
- end
-
- def initialize(path_or_data, **options)
- @path_or_data = path_or_data
- @options = options
- if @options.key?(:delimiter)
- @options[:col_sep] = @options.delete(:delimiter)
- end
- @compression = @options.delete(:compression)
- end
-
- def load
- case @path_or_data
- when Pathname
- load_from_path(@path_or_data.to_path)
- when /\A.+\.csv\z/i
- load_from_path(@path_or_data)
- else
- load_data(@path_or_data)
- end
- end
-
- private
- def open_csv(path, **options)
- CSV.open(path, **options) do |csv|
- yield(csv)
- end
- end
-
- def parse_csv_data(data, **options)
- csv = CSV.new(data, **options)
- begin
- yield(csv)
- ensure
- csv.close
- end
- end
-
- def read_csv(csv)
- values_set = []
- csv.each do |row|
- if row.is_a?(CSV::Row)
- row = row.collect(&:last)
- end
- row.each_with_index do |value, i|
- values = (values_set[i] ||= [])
- values << value
- end
- end
- return nil if values_set.empty?
-
- arrays = values_set.collect.with_index do |values, i|
- ArrayBuilder.build(values)
- end
- if csv.headers
- names = csv.headers
- else
- names = arrays.size.times.collect(&:to_s)
- end
- raw_table = {}
- names.each_with_index do |name, i|
- raw_table[name] = arrays[i]
- end
- Table.new(raw_table)
- end
-
- def reader_options
- options = CSVReadOptions.new
- @options.each do |key, value|
- case key
- when :headers
- case value
- when ::Array
- options.column_names = value
- when String
- return nil
- else
- if value
- options.generate_column_names = false
- else
- options.generate_column_names = true
- end
- end
- when :column_types
- value.each do |name, type|
- options.add_column_type(name, type)
- end
- when :schema
- options.add_schema(value)
- when :encoding
- # process encoding on opening input
- when :col_sep
- options.delimiter = value
- else
- setter = "#{key}="
- if options.respond_to?(setter)
- options.__send__(setter, value)
- else
- return nil
- end
- end
- end
- options
- end
-
- def open_decompress_input(raw_input)
- if @compression
- codec = Codec.new(@compression)
- CompressedInputStream.open(codec, raw_input) do |input|
- yield(input)
- end
- else
- yield(raw_input)
- end
- end
-
- def open_encoding_convert_stream(raw_input, &block)
- encoding = @options[:encoding]
- if encoding
- converter = Gio::CharsetConverter.new("UTF-8", encoding)
- convert_input_stream =
- Gio::ConverterInputStream.new(raw_input, converter)
- GIOInputStream.open(convert_input_stream, &block)
- else
- yield(raw_input)
- end
- end
-
- def wrap_input(raw_input)
- open_decompress_input(raw_input) do |input_|
- open_encoding_convert_stream(input_) do |input__|
- yield(input__)
- end
- end
- end
-
- def load_from_path(path)
- options = reader_options
- if options
- begin
- MemoryMappedInputStream.open(path) do |raw_input|
- wrap_input(raw_input) do |input|
- return CSVReader.new(input, options).read
- end
- end
- rescue Arrow::Error::Invalid, Gio::Error
- end
- end
-
- options = update_csv_parse_options(@options, :open_csv, path)
- open_csv(path, **options) do |csv|
- read_csv(csv)
- end
- end
-
- def load_data(data)
- options = reader_options
- if options
- begin
- BufferInputStream.open(Buffer.new(data)) do |raw_input|
- wrap_input(raw_input) do |input|
- return CSVReader.new(input, options).read
- end
- end
- rescue Arrow::Error::Invalid, Gio::Error
- end
- end
-
- options = update_csv_parse_options(@options, :parse_csv_data, data)
- parse_csv_data(data, **options) do |csv|
- read_csv(csv)
- end
- end
-
- def selective_converter(target_index)
- lambda do |field, field_info|
- if target_index.nil? or field_info.index == target_index
- yield(field)
- else
- field
- end
- end
- end
-
- BOOLEAN_CONVERTER = lambda do |field|
- begin
- encoded_field = field.encode(CSV::ConverterEncoding)
- rescue EncodingError
- field
- else
- case encoded_field
- when "true"
- true
- when "false"
- false
- else
- field
- end
- end
- end
-
- ISO8601_CONVERTER = lambda do |field|
- begin
- encoded_field = field.encode(CSV::ConverterEncoding)
- rescue EncodingError
- field
- else
- begin
- ::Time.iso8601(encoded_field)
- rescue ArgumentError
- field
- end
- end
- end
-
- AVAILABLE_CSV_PARSE_OPTIONS = {}
- CSV.instance_method(:initialize).parameters.each do |type, name|
- AVAILABLE_CSV_PARSE_OPTIONS[name] = true if type == :key
- end
-
- def update_csv_parse_options(options, create_csv, *args)
- if options.key?(:converters)
- new_options = options.dup
- else
- converters = [:all, BOOLEAN_CONVERTER, ISO8601_CONVERTER]
- new_options = options.merge(converters: converters)
- end
-
- # TODO: Support :schema and :column_types
-
- unless AVAILABLE_CSV_PARSE_OPTIONS.empty?
- new_options.select! do |key, value|
- AVAILABLE_CSV_PARSE_OPTIONS.key?(key)
- end
- end
-
- unless options.key?(:headers)
- __send__(create_csv, *args, **new_options) do |csv|
- new_options[:headers] = have_header?(csv)
- end
- end
- unless options.key?(:converters)
- __send__(create_csv, *args, **new_options) do |csv|
- new_options[:converters] = detect_robust_converters(csv)
- end
- end
-
- new_options
- end
-
- def have_header?(csv)
- if @options.key?(:headers)
- return @options[:headers]
- end
-
- row1 = csv.shift
- return false if row1.nil?
- return false if row1.any?(&:nil?)
-
- row2 = csv.shift
- return nil if row2.nil?
- return true if row2.any?(&:nil?)
-
- return false if row1.any? {|value| not value.is_a?(String)}
-
- if row1.collect(&:class) != row2.collect(&:class)
- return true
- end
-
- nil
- end
-
- def detect_robust_converters(csv)
- column_types = []
- csv.each do |row|
- if row.is_a?(CSV::Row)
- each_value = Enumerator.new do |yielder|
- row.each do |_name, value|
- yielder << value
- end
- end
- else
- each_value = row.each
- end
- each_value.with_index do |value, i|
- current_column_type = column_types[i]
- next if current_column_type == :string
-
- candidate_type = nil
- case value
- when nil
- next
- when "true", "false", true, false
- candidate_type = :boolean
- when Integer
- candidate_type = :integer
- if current_column_type == :float
- candidate_type = :float
- end
- when Float
- candidate_type = :float
- if current_column_type == :integer
- column_types[i] = candidate_type
- end
- when ::Time
- candidate_type = :time
- when DateTime
- candidate_type = :date_time
- when Date
- candidate_type = :date
- when String
- next if value.empty?
- candidate_type = :string
- else
- candidate_type = :string
- end
-
- column_types[i] ||= candidate_type
- if column_types[i] != candidate_type
- column_types[i] = :string
- end
- end
- end
-
- converters = []
- column_types.each_with_index do |type, i|
- case type
- when :boolean
- converters << selective_converter(i, &BOOLEAN_CONVERTER)
- when :integer
- converters << selective_converter(i) do |field|
- if field.nil? or field.empty?
- nil
- else
- CSV::Converters[:integer].call(field)
- end
- end
- when :float
- converters << selective_converter(i) do |field|
- if field.nil? or field.empty?
- nil
- else
- CSV::Converters[:float].call(field)
- end
- end
- when :time
- converters << selective_converter(i, &ISO8601_CONVERTER)
- when :date_time
- converters << selective_converter(i, &CSV::Converters[:date_time])
- when :date
- converters << selective_converter(i, &CSV::Converters[:date])
- end
- end
- converters
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/csv-read-options.rb b/ruby/red-arrow/lib/arrow/csv-read-options.rb
deleted file mode 100644
index dec3dec..0000000
--- a/ruby/red-arrow/lib/arrow/csv-read-options.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class CSVReadOptions
- alias_method :add_column_type_raw, :add_column_type
- def add_column_type(name, type)
- add_column_type_raw(name, DataType.resolve(type))
- end
-
- alias_method :delimiter_raw, :delimiter
- def delimiter
- delimiter_raw.chr
- end
-
- alias_method :delimiter_raw=, :delimiter=
- def delimiter=(delimiter)
- case delimiter
- when String
- if delimiter.bytesize != 1
- message = "delimiter must be 1 byte character: #{delimiter.inspect}"
- raise ArgumentError, message
- end
- delimiter = delimiter.ord
- end
- self.delimiter_raw = delimiter
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/data-type.rb b/ruby/red-arrow/lib/arrow/data-type.rb
deleted file mode 100644
index 07b4525..0000000
--- a/ruby/red-arrow/lib/arrow/data-type.rb
+++ /dev/null
@@ -1,198 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class DataType
- class << self
- # Ensure returning suitable {Arrow::DataType}.
- #
- # @overload resolve(data_type)
- #
- # Returns the given data type itself. This is convenient to
- # use this method as {Arrow::DataType} converter.
- #
- # @param data_type [Arrow::DataType] The data type.
- #
- # @return [Arrow::DataType] The given data type itself.
- #
- # @overload resolve(name)
- #
- # Creates a suitable data type from the given type name. For
- # example, you can create {Arrow::BooleanDataType} from
- # `:boolean`.
- #
- # @param name [String, Symbol] The type name of the data type.
- #
- # @return [Arrow::DataType] A new suitable data type.
- #
- # @example Create a boolean data type
- # Arrow::DataType.resolve(:boolean)
- #
- # @overload resolve(name_with_arguments)
- #
- # Creates a new suitable data type from the given type name
- # with arguments.
- #
- # @param name_with_arguments [::Array<String, ...>]
- # The type name of the data type as the first element.
- #
- # The rest elements are additional information of the data type.
- #
- # For example, {Arrow::TimestampDataType} needs unit as
- # additional information.
- #
- # @return [Arrow::DataType] A new suitable data type.
- #
- # @example Create a boolean data type
- # Arrow::DataType.resolve([:boolean])
- #
- # @example Create a milliseconds unit timestamp data type
- # Arrow::DataType.resolve([:timestamp, :milli])
- #
- # @overload resolve(description)
- #
- # Creates a new suitable data type from the given data type
- # description.
- #
- # Data type description is a raw `Hash`. Data type description
- # must have `:type` value. `:type` is the type of the data type.
- #
- # If the type needs additional information, you need to
- # specify it. See constructor document what information is
- # needed. For example, {Arrow::ListDataType#initialize} needs
- # `:field` value.
- #
- # @param description [Hash] The description of the data type.
- #
- # @option description [String, Symbol] :type The type name of
- # the data type.
- #
- # @return [Arrow::DataType] A new suitable data type.
- #
- # @example Create a boolean data type
- # Arrow::DataType.resolve(type: :boolean)
- #
- # @example Create a list data type
- # Arrow::DataType.resolve(type: :list,
- # field: {name: "visible", type: :boolean})
- def resolve(data_type)
- case data_type
- when DataType
- data_type
- when String, Symbol
- resolve_class(data_type).new
- when ::Array
- type, *arguments = data_type
- resolve_class(type).new(*arguments)
- when Hash
- type = nil
- description = {}
- data_type.each do |key, value|
- key = key.to_sym
- case key
- when :type
- type = value
- else
- description[key] = value
- end
- end
- if type.nil?
- message =
- "data type description must have :type value: #{data_type.inspect}"
- raise ArgumentError, message
- end
- data_type_class = resolve_class(type)
- if description.empty?
- data_type_class.new
- else
- data_type_class.new(description)
- end
- else
- message =
- "data type must be " +
- "Arrow::DataType, String, Symbol, [String, ...], [Symbol, ...] " +
- "{type: String, ...} or {type: Symbol, ...}: #{data_type.inspect}"
- raise ArgumentError, message
- end
- end
-
- def sub_types
- types = {}
- gtype.children.each do |child|
- sub_type = child.to_class
- types[sub_type] = true
- sub_type.sub_types.each do |sub_sub_type|
- types[sub_sub_type] = true
- end
- end
- types.keys
- end
-
- def try_convert(value)
- begin
- resolve(value)
- rescue ArgumentError
- nil
- end
- end
-
- private
- def resolve_class(data_type)
- components = data_type.to_s.split("_").collect(&:capitalize)
- data_type_name = components.join.gsub(/\AUint/, "UInt")
- data_type_class_name = "#{data_type_name}DataType"
- unless Arrow.const_defined?(data_type_class_name)
- available_types = []
- Arrow.constants.each do |name|
- name = name.to_s
- next if name == "DataType"
- next unless name.end_with?("DataType")
- name = name.gsub(/DataType\z/, "")
- components = name.scan(/(UInt[0-9]+|[A-Z][a-z\d]+)/).flatten
- available_types << components.collect(&:downcase).join("_").to_sym
- end
- message =
- "unknown type: <#{data_type.inspect}>: " +
- "available types: #{available_types.inspect}"
- raise ArgumentError, message
- end
- data_type_class = Arrow.const_get(data_type_class_name)
- if data_type_class.gtype.abstract?
- not_abstract_types = data_type_class.sub_types.find_all do |sub_type|
- not sub_type.gtype.abstract?
- end
- not_abstract_types = not_abstract_types.sort_by do |type|
- type.name
- end
- message =
- "abstract type: <#{data_type.inspect}>: " +
- "use one of not abstract type: #{not_abstract_types.inspect}"
- raise ArgumentError, message
- end
- data_type_class
- end
- end
-
- def build_array(values)
- base_name = self.class.name.gsub(/DataType\z/, "")
- builder_class = self.class.const_get("#{base_name}ArrayBuilder")
- args = [values]
- args.unshift(self) unless builder_class.buildable?(args)
- builder_class.build(*args)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/date32-array-builder.rb b/ruby/red-arrow/lib/arrow/date32-array-builder.rb
deleted file mode 100644
index dedbba8..0000000
--- a/ruby/red-arrow/lib/arrow/date32-array-builder.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Date32ArrayBuilder
- private
- UNIX_EPOCH = Date.new(1970, 1, 1)
- def convert_to_arrow_value(value)
- value = value.to_date if value.respond_to?(:to_date)
-
- if value.is_a?(Date)
- (value - UNIX_EPOCH).to_i
- else
- value
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/date32-array.rb b/ruby/red-arrow/lib/arrow/date32-array.rb
deleted file mode 100644
index 121dbcb..0000000
--- a/ruby/red-arrow/lib/arrow/date32-array.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Date32Array
- def get_value(i)
- to_date(get_raw_value(i))
- end
-
- private
- UNIX_EPOCH = 2440588
- def to_date(raw_value)
- Date.jd(UNIX_EPOCH + raw_value)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/date64-array-builder.rb b/ruby/red-arrow/lib/arrow/date64-array-builder.rb
deleted file mode 100644
index 6581181..0000000
--- a/ruby/red-arrow/lib/arrow/date64-array-builder.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Date64ArrayBuilder
- private
- def convert_to_arrow_value(value)
- if value.respond_to?(:to_time) and not value.is_a?(::Time)
- value = value.to_time
- end
-
- if value.is_a?(::Time)
- value.to_i * 1_000 + value.usec / 1_000
- else
- value
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/date64-array.rb b/ruby/red-arrow/lib/arrow/date64-array.rb
deleted file mode 100644
index 9b8a924..0000000
--- a/ruby/red-arrow/lib/arrow/date64-array.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Date64Array
- def get_value(i)
- to_datetime(get_raw_value(i))
- end
-
- private
- def to_datetime(raw_value)
- ::Time.at(*raw_value.divmod(1_000)).to_datetime
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal128-array-builder.rb b/ruby/red-arrow/lib/arrow/decimal128-array-builder.rb
deleted file mode 100644
index d380ce0..0000000
--- a/ruby/red-arrow/lib/arrow/decimal128-array-builder.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal128ArrayBuilder
- class << self
- def build(data_type, values)
- builder = new(data_type)
- builder.build(values)
- end
- end
-
- alias_method :append_value_raw, :append_value
- def append_value(value)
- append_value_raw(normalize_value(value))
- end
-
- alias_method :append_values_raw, :append_values
- def append_values(values, is_valids=nil)
- if values.is_a?(::Array)
- values = values.collect do |value|
- normalize_value(value)
- end
- append_values_raw(values, is_valids)
- else
- append_values_packed(values, is_valids)
- end
- end
-
- private
- def normalize_value(value)
- case value
- when String
- Decimal128.new(value)
- when Float
- Decimal128.new(value.to_s)
- when BigDecimal
- Decimal128.new(value.to_s)
- else
- value
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal128-array.rb b/ruby/red-arrow/lib/arrow/decimal128-array.rb
deleted file mode 100644
index a5ee53b..0000000
--- a/ruby/red-arrow/lib/arrow/decimal128-array.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal128Array
- def get_value(i)
- BigDecimal(format_value(i))
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal128-data-type.rb b/ruby/red-arrow/lib/arrow/decimal128-data-type.rb
deleted file mode 100644
index 4b55838..0000000
--- a/ruby/red-arrow/lib/arrow/decimal128-data-type.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal128DataType
- MAX_PRECISION = max_precision
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::Decimal128DataType}.
- #
- # @overload initialize(precision, scale)
- #
- # @param precision [Integer] The precision of the decimal data
- # type. It's the number of digits including the number of
- # digits after the decimal point.
- #
- # @param scale [Integer] The scale of the decimal data
- # type. It's the number of digits after the decimal point.
- #
- # @example Create a decimal data type for "XXXXXX.YY" decimal
- # Arrow::Decimal128DataType.new(8, 2)
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the decimal data
- # type. It must have `:precision` and `:scale` values.
- #
- # @option description [Integer] :precision The precision of the
- # decimal data type. It's the number of digits including the
- # number of digits after the decimal point.
- #
- # @option description [Integer] :scale The scale of the decimal
- # data type. It's the number of digits after the decimal
- # point.
- #
- # @example Create a decimal data type for "XXXXXX.YY" decimal
- # Arrow::Decimal128DataType.new(precision: 8,
- # scale: 2)
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- precision = description[:precision]
- scale = description[:scale]
- when 2
- precision, scale = args
- else
- message = "wrong number of arguments (given, #{n_args}, expected 1..2)"
- raise ArgumentError, message
- end
- initialize_raw(precision, scale)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal128.rb b/ruby/red-arrow/lib/arrow/decimal128.rb
deleted file mode 100644
index bf853ae..0000000
--- a/ruby/red-arrow/lib/arrow/decimal128.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal128
- alias_method :to_s_raw, :to_s
-
- # @overload to_s
- #
- # @return [String]
- # The string representation of the decimal.
- #
- # @overload to_s(scale)
- #
- # @param scale [Integer] The scale of the decimal.
- # @return [String]
- # The string representation of the decimal including the scale.
- #
- # @since 0.13.0
- def to_s(scale=nil)
- if scale
- to_string_scale(scale)
- else
- to_s_raw
- end
- end
-
- alias_method :abs!, :abs
-
- # @since 3.0.0
- def abs
- copied = dup
- copied.abs!
- copied
- end
-
- alias_method :negate!, :negate
-
- # @since 3.0.0
- def negate
- copied = dup
- copied.negate!
- copied
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal256-array-builder.rb b/ruby/red-arrow/lib/arrow/decimal256-array-builder.rb
deleted file mode 100644
index fb89ff0..0000000
--- a/ruby/red-arrow/lib/arrow/decimal256-array-builder.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal256ArrayBuilder
- class << self
- # @since 3.0.0
- def build(data_type, values)
- builder = new(data_type)
- builder.build(values)
- end
- end
-
- alias_method :append_value_raw, :append_value
- # @since 3.0.0
- def append_value(value)
- append_value_raw(normalize_value(value))
- end
-
- alias_method :append_values_raw, :append_values
- # @since 3.0.0
- def append_values(values, is_valids=nil)
- if values.is_a?(::Array)
- values = values.collect do |value|
- normalize_value(value)
- end
- append_values_raw(values, is_valids)
- else
- append_values_packed(values, is_valids)
- end
- end
-
- private
- def normalize_value(value)
- case value
- when String
- Decimal256.new(value)
- when Float
- Decimal256.new(value.to_s)
- when BigDecimal
- Decimal256.new(value.to_s)
- else
- value
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal256-array.rb b/ruby/red-arrow/lib/arrow/decimal256-array.rb
deleted file mode 100644
index 8c2306d..0000000
--- a/ruby/red-arrow/lib/arrow/decimal256-array.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal256Array
- # @since 3.0.0
- def get_value(i)
- BigDecimal(format_value(i))
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal256-data-type.rb b/ruby/red-arrow/lib/arrow/decimal256-data-type.rb
deleted file mode 100644
index 8264e38..0000000
--- a/ruby/red-arrow/lib/arrow/decimal256-data-type.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal256DataType
- MAX_PRECISION = max_precision
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::Decimal256DataType}.
- #
- # @overload initialize(precision, scale)
- #
- # @param precision [Integer] The precision of the decimal data
- # type. It's the number of digits including the number of
- # digits after the decimal point.
- #
- # @param scale [Integer] The scale of the decimal data
- # type. It's the number of digits after the decimal point.
- #
- # @example Create a decimal data type for "XXXXXX.YY" decimal
- # Arrow::Decimal256DataType.new(8, 2)
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the decimal data
- # type. It must have `:precision` and `:scale` values.
- #
- # @option description [Integer] :precision The precision of the
- # decimal data type. It's the number of digits including the
- # number of digits after the decimal point.
- #
- # @option description [Integer] :scale The scale of the decimal
- # data type. It's the number of digits after the decimal
- # point.
- #
- # @example Create a decimal data type for "XXXXXX.YY" decimal
- # Arrow::Decimal256DataType.new(precision: 8,
- # scale: 2)
- #
- # @since 3.0.0
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- precision = description[:precision]
- scale = description[:scale]
- when 2
- precision, scale = args
- else
- message = "wrong number of arguments (given, #{n_args}, expected 1..2)"
- raise ArgumentError, message
- end
- initialize_raw(precision, scale)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/decimal256.rb b/ruby/red-arrow/lib/arrow/decimal256.rb
deleted file mode 100644
index 1a7097a..0000000
--- a/ruby/red-arrow/lib/arrow/decimal256.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Decimal256
- alias_method :to_s_raw, :to_s
-
- # @overload to_s
- #
- # @return [String]
- # The string representation of the decimal.
- #
- # @overload to_s(scale)
- #
- # @param scale [Integer] The scale of the decimal.
- # @return [String]
- # The string representation of the decimal including the scale.
- #
- # @since 3.0.0
- def to_s(scale=nil)
- if scale
- to_string_scale(scale)
- else
- to_s_raw
- end
- end
-
- alias_method :abs!, :abs
-
- # @since 3.0.0
- def abs
- copied = dup
- copied.abs!
- copied
- end
-
- alias_method :negate!, :negate
-
- # @since 3.0.0
- def negate
- copied = dup
- copied.negate!
- copied
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/dense-union-data-type.rb b/ruby/red-arrow/lib/arrow/dense-union-data-type.rb
deleted file mode 100644
index 6d2bf5e..0000000
--- a/ruby/red-arrow/lib/arrow/dense-union-data-type.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class DenseUnionDataType
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::DenseUnionDataType}.
- #
- # @overload initialize(fields, type_codes)
- #
- # @param fields [::Array<Arrow::Field, Hash>] The fields of the
- # dense union data type. You can mix {Arrow::Field} and field
- # description in the fields.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @param type_codes [::Array<Integer>] The IDs that indicates
- # corresponding fields.
- #
- # @example Create a dense union data type for `{2: visible, 9: count}`
- # fields = [
- # Arrow::Field.new("visible", :boolean),
- # {
- # name: "count",
- # type: :int32,
- # },
- # ]
- # Arrow::DenseUnionDataType.new(fields, [2, 9])
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the dense union
- # data type. It must have `:fields` and `:type_codes` values.
- #
- # @option description [::Array<Arrow::Field, Hash>] :fields The
- # fields of the dense union data type. You can mix
- # {Arrow::Field} and field description in the fields.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @option description [::Array<Integer>] :type_codes The IDs
- # that indicates corresponding fields.
- #
- # @example Create a dense union data type for `{2: visible, 9: count}`
- # fields = [
- # Arrow::Field.new("visible", :boolean),
- # {
- # name: "count",
- # type: :int32,
- # },
- # ]
- # Arrow::DenseUnionDataType.new(fields: fields,
- # type_codes: [2, 9])
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- fields = description[:fields]
- type_codes = description[:type_codes]
- when 2
- fields, type_codes = args
- else
- message = "wrong number of arguments (given, #{n_args}, expected 1..2)"
- raise ArgumentError, message
- end
- fields = fields.collect do |field|
- field = Field.new(field) unless field.is_a?(Field)
- field
- end
- initialize_raw(fields, type_codes)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/dictionary-array.rb b/ruby/red-arrow/lib/arrow/dictionary-array.rb
deleted file mode 100644
index 70591ab..0000000
--- a/ruby/red-arrow/lib/arrow/dictionary-array.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class DictionaryArray
- def get_value(i)
- dictionary[indices[i]]
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/dictionary-data-type.rb b/ruby/red-arrow/lib/arrow/dictionary-data-type.rb
deleted file mode 100644
index 8396e31..0000000
--- a/ruby/red-arrow/lib/arrow/dictionary-data-type.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class DictionaryDataType
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::DictionaryDataType}.
- #
- # @overload initialize(index_data_type, value_data_type, ordered)
- #
- # @param index_data_type [Arrow::DataType, Hash, String, Symbol]
- # The index data type of the dictionary data type. It must be
- # signed integer data types. Here are available signed integer
- # data types:
- #
- # * Arrow::Int8DataType
- # * Arrow::Int16DataType
- # * Arrow::Int32DataType
- # * Arrow::Int64DataType
- #
- # You can specify data type as a description by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @param value_data_type [Arrow::DataType, Hash, String, Symbol]
- # The value data type of the dictionary data type.
- #
- # You can specify data type as a description by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @param ordered [Boolean] Whether dictionary contents are
- # ordered or not.
- #
- # @example Create a dictionary data type for `{0: "Hello", 1: "World"}`
- # index_data_type = :int8
- # value_data_type = :string
- # ordered = true
- # Arrow::DictionaryDataType.new(index_data_type,
- # value_data_type,
- # ordered)
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the dictionary
- # data type. It must have `:index_data_type`, `:dictionary`
- # and `:ordered` values.
- #
- # @option description [Arrow::DataType, Hash, String, Symbol]
- # :index_data_type The index data type of the dictionary data
- # type. It must be signed integer data types. Here are
- # available signed integer data types:
- #
- # * Arrow::Int8DataType
- # * Arrow::Int16DataType
- # * Arrow::Int32DataType
- # * Arrow::Int64DataType
- #
- # You can specify data type as a description by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @option description [Arrow::DataType, Hash, String, Symbol]
- # :value_data_type
- # The value data type of the dictionary data type.
- #
- # You can specify data type as a description by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @option description [Boolean] :ordered Whether dictionary
- # contents are ordered or not.
- #
- # @example Create a dictionary data type for `{0: "Hello", 1: "World"}`
- # Arrow::DictionaryDataType.new(index_data_type: :int8,
- # value_data_type: :string,
- # ordered: true)
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- index_data_type = description[:index_data_type]
- value_data_type = description[:value_data_type]
- ordered = description[:ordered]
- when 3
- index_data_type, value_data_type, ordered = args
- else
- message = "wrong number of arguments (given, #{n_args}, expected 1 or 3)"
- raise ArgumentError, message
- end
- index_data_type = DataType.resolve(index_data_type)
- value_data_type = DataType.resolve(value_data_type)
- initialize_raw(index_data_type, value_data_type, ordered)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/field-containable.rb b/ruby/red-arrow/lib/arrow/field-containable.rb
deleted file mode 100644
index e4dbf4e..0000000
--- a/ruby/red-arrow/lib/arrow/field-containable.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module FieldContainable
- def find_field(name_or_index)
- case name_or_index
- when String, Symbol
- name = name_or_index
- get_field_by_name(name)
- when Integer
- index = name_or_index
- raise if index < 0
- index += n_fields if index < 0
- return nil if index < 0 or index >= n_fields
- get_field(index)
- else
- message = "field name or index must be String, Symbol or Integer"
- message << ": <#{name_or_index.inspect}>"
- raise ArgumentError, message
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/field.rb b/ruby/red-arrow/lib/arrow/field.rb
deleted file mode 100644
index e439cb9..0000000
--- a/ruby/red-arrow/lib/arrow/field.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Field
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::Field}.
- #
- # @overload initialize(name, data_type)
- #
- # @param name [String, Symbol] The name of the field.
- #
- # @param data_type [Arrow::DataType, Hash, String, Symbol] The
- # data type of the field.
- #
- # You can specify data type as a description by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @example Create a field with {Arrow::DataType}s
- # Arrow::Field.new("visible", Arrow::BooleanDataType.new)
- #
- # @example Create a field with data type description
- # Arrow::Field.new("visible", :boolean)
- #
- # @example Create a field with name as `Symbol`
- # Arrow::Field.new(:visible, :boolean)
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the field.
- #
- # Field description is a raw `Hash`. Field description must
- # have `:name` and `:data_type` values. `:name` is the name of
- # the field. `:data_type` is the data type of the field. You
- # can use {Arrow::DataType} or data type description as
- # `:data_type` value.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # There is a shortcut for convenience. If field description
- # doesn't have `:data_type`, all keys except `:name` are
- # processes as data type description. For example, the
- # following field descriptions are the same:
- #
- # ```ruby
- # {name: "visible", data_type: {type: :boolean}}
- # {name: "visible", type: :boolean} # Shortcut version
- # ```
- #
- # @option description [String, Symbol] :name The name of the field.
- #
- # @option description [Arrow::DataType, Hash] :data_type The
- # data type of the field. You can specify data type description
- # by `Hash`.
- #
- # See {Arrow::DataType.resolve} how to specify data type
- # description.
- #
- # @example Create a field with {Arrow::DataType}s
- # Arrow::Field.new(name: "visible",
- # data_type: Arrow::BooleanDataType.new)
- #
- # @example Create a field with data type description
- # Arrow::Field.new(name: "visible", data_type: {type: :boolean}
- #
- # @example Create a field with shortcut form
- # Arrow::Field.new(name: "visible", type: :boolean)
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- name = nil
- data_type = nil
- data_type_description = {}
- description.each do |key, value|
- key = key.to_sym
- case key
- when :name
- name = value
- when :data_type
- data_type = DataType.resolve(value)
- else
- data_type_description[key] = value
- end
- end
- data_type ||= DataType.resolve(data_type_description)
- when 2
- name = args[0]
- data_type = DataType.resolve(args[1])
- else
- message = "wrong number of arguments (given #{n_args}, expected 1..2)"
- raise ArgumentError, message
- end
-
- initialize_raw(name, data_type)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/file-output-stream.rb b/ruby/red-arrow/lib/arrow/file-output-stream.rb
deleted file mode 100644
index f39ad14..0000000
--- a/ruby/red-arrow/lib/arrow/file-output-stream.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class FileOutputStream
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- def initialize(path, options={})
- append = nil
- case options
- when true, false
- append = options
- when Hash
- append = options[:append]
- end
- append = false if append.nil?
- initialize_raw(path, append)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/fixed-size-binary-array-builder.rb b/ruby/red-arrow/lib/arrow/fixed-size-binary-array-builder.rb
deleted file mode 100644
index 516d814..0000000
--- a/ruby/red-arrow/lib/arrow/fixed-size-binary-array-builder.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class FixedSizeBinaryArrayBuilder
- class << self
- # @since 3.0.0
- def build(data_type, values)
- builder = new(data_type)
- builder.build(values)
- end
- end
-
- alias_method :append_values_raw, :append_values
- # @since 3.0.0
- def append_values(values, is_valids=nil)
- if values.is_a?(::Array)
- append_values_raw(values, is_valids)
- else
- append_values_packed(values, is_valids)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/fixed-size-binary-array.rb b/ruby/red-arrow/lib/arrow/fixed-size-binary-array.rb
deleted file mode 100644
index 37c121d..0000000
--- a/ruby/red-arrow/lib/arrow/fixed-size-binary-array.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class FixedSizeBinaryArray
- alias_method :get_value_raw, :get_value
- # @since 3.0.0
- def get_value(i)
- get_value_raw(i).to_s
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/generic-filterable.rb b/ruby/red-arrow/lib/arrow/generic-filterable.rb
deleted file mode 100644
index 50a7914..0000000
--- a/ruby/red-arrow/lib/arrow/generic-filterable.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module GenericFilterable
- class << self
- def included(base)
- base.__send__(:alias_method, :filter_raw, :filter)
- base.__send__(:alias_method, :filter, :filter_generic)
- end
- end
-
- def filter_generic(filter, options=nil)
- case filter
- when ::Array
- filter_raw(BooleanArray.new(filter), options)
- when ChunkedArray
- if respond_to?(:filter_chunked_array)
- filter_chunked_array(filter, options)
- else
- # TODO: Implement this in C++
- filter_raw(filter.pack, options)
- end
- else
- filter_raw(filter, options)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/generic-takeable.rb b/ruby/red-arrow/lib/arrow/generic-takeable.rb
deleted file mode 100644
index f32b43f..0000000
--- a/ruby/red-arrow/lib/arrow/generic-takeable.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module GenericTakeable
- class << self
- def included(base)
- base.__send__(:alias_method, :take_raw, :take)
- base.__send__(:alias_method, :take, :take_generic)
- end
- end
-
- def take_generic(indices)
- case indices
- when ::Array
- take_raw(IntArrayBuilder.build(indices))
- when ChunkedArray
- take_chunked_array(indices)
- else
- take_raw(indices)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/group.rb b/ruby/red-arrow/lib/arrow/group.rb
deleted file mode 100644
index 568e0e8..0000000
--- a/ruby/red-arrow/lib/arrow/group.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- # Experimental
- #
- # TODO: Almost codes should be implemented in Apache Arrow C++.
- class Group
- def initialize(table, keys)
- @table = table
- @keys = keys
- end
-
- def count
- key_names = @keys.collect(&:to_s)
- target_columns = @table.columns.reject do |column|
- key_names.include?(column.name)
- end
- aggregate(target_columns) do |column, indexes|
- n = 0
- indexes.each do |index|
- n += 1 unless column.null?(index)
- end
- n
- end
- end
-
- def sum
- key_names = @keys.collect(&:to_s)
- target_columns = @table.columns.reject do |column|
- key_names.include?(column.name) or
- not column.data_type.is_a?(NumericDataType)
- end
- aggregate(target_columns) do |column, indexes|
- n = 0
- indexes.each do |index|
- value = column[index]
- n += value unless value.nil?
- end
- n
- end
- end
-
- def average
- key_names = @keys.collect(&:to_s)
- target_columns = @table.columns.reject do |column|
- key_names.include?(column.name) or
- not column.data_type.is_a?(NumericDataType)
- end
- aggregate(target_columns) do |column, indexes|
- average = 0.0
- n = 0
- indexes.each do |index|
- value = column[index]
- unless value.nil?
- n += 1
- average += (value - average) / n
- end
- end
- average
- end
- end
-
- def min
- key_names = @keys.collect(&:to_s)
- target_columns = @table.columns.reject do |column|
- key_names.include?(column.name) or
- not column.data_type.is_a?(NumericDataType)
- end
- aggregate(target_columns) do |column, indexes|
- n = nil
- indexes.each do |index|
- value = column[index]
- next if value.nil?
- n ||= value
- n = value if value < n
- end
- n
- end
- end
-
- def max
- key_names = @keys.collect(&:to_s)
- target_columns = @table.columns.reject do |column|
- key_names.include?(column.name) or
- not column.data_type.is_a?(NumericDataType)
- end
- aggregate(target_columns) do |column, indexes|
- n = nil
- indexes.each do |index|
- value = column[index]
- next if value.nil?
- n ||= value
- n = value if value > n
- end
- n
- end
- end
-
- private
- def aggregate(target_columns)
- sort_values = @table.n_rows.times.collect do |i|
- key_values = @keys.collect do |key|
- @table[key][i]
- end
- [key_values, i]
- end
- sorted = sort_values.sort_by do |key_values, i|
- key_values
- end
-
- grouped_keys = []
- aggregated_arrays_raw = []
- target_columns.size.times do
- aggregated_arrays_raw << []
- end
- indexes = []
- sorted.each do |key_values, i|
- if grouped_keys.empty?
- grouped_keys << key_values
- indexes.clear
- indexes << i
- else
- if key_values == grouped_keys.last
- indexes << i
- else
- grouped_keys << key_values
- target_columns.each_with_index do |column, j|
- aggregated_arrays_raw[j] << yield(column, indexes)
- end
- indexes.clear
- indexes << i
- end
- end
- end
- target_columns.each_with_index do |column, j|
- aggregated_arrays_raw[j] << yield(column, indexes)
- end
-
- grouped_key_arrays_raw = grouped_keys.transpose
- fields = []
- arrays = []
- @keys.each_with_index do |key, i|
- key_column = @table[key]
- key_column_array_raw = grouped_key_arrays_raw[i]
- key_column_array = key_column.data_type.build_array(key_column_array_raw)
- fields << key_column.field
- arrays << key_column_array
- end
- target_columns.each_with_index do |column, i|
- array = ArrayBuilder.build(aggregated_arrays_raw[i])
- arrays << array
- fields << Field.new(column.field.name, array.value_data_type)
- end
- Table.new(fields, arrays)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/list-array-builder.rb b/ruby/red-arrow/lib/arrow/list-array-builder.rb
deleted file mode 100644
index d889c8a..0000000
--- a/ruby/red-arrow/lib/arrow/list-array-builder.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class ListArrayBuilder
- class << self
- def build(data_type, values)
- builder = new(data_type)
- builder.build(values)
- end
- end
-
- alias_method :append_value_raw, :append_value
-
- # @overload append_value
- #
- # Starts appending a list record. You also need to append list
- # value by {#value_builder}.
- #
- # @overload append_value(list)
- #
- # Appends a list record including list value.
- #
- # @param value [nil, ::Array] The list value of the record.
- #
- # If this is `nil`, the list record is null.
- #
- # If this is `Array`, it's the list value of the record.
- #
- # @since 0.12.0
- def append_value(*args)
- n_args = args.size
-
- case n_args
- when 0
- append_value_raw
- when 1
- value = args[0]
- case value
- when nil
- append_null
- when ::Array
- append_value_raw
- @value_builder ||= value_builder
- @value_builder.append(*value)
- else
- message = "list value must be nil or Array: #{value.inspect}"
- raise ArgumentError, message
- end
- else
- message = "wrong number of arguments (given #{n_args}, expected 0..1)"
- raise ArgumentError, message
- end
- end
-
- def append_values(lists, is_valids=nil)
- if is_valids
- is_valids.each_with_index do |is_valid, i|
- if is_valid
- append_value(lists[i])
- else
- append_null
- end
- end
- else
- lists.each do |list|
- append_value(list)
- end
- end
- end
-
- # @since 0.12.0
- def append(*values)
- if values.empty?
- # For backward compatibility
- append_value
- else
- super
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/list-data-type.rb b/ruby/red-arrow/lib/arrow/list-data-type.rb
deleted file mode 100644
index cfcdd2a..0000000
--- a/ruby/red-arrow/lib/arrow/list-data-type.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class ListDataType
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::ListDataType}.
- #
- # @overload initialize(field)
- #
- # @param field [Arrow::Field, Hash] The field of the list data
- # type. You can also specify field description by `Hash`.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @example Create a list data type with {Arrow::Field}
- # visible_field = Arrow::Field.new("visible", :boolean)
- # Arrow::ListDataType.new(visible_field)
- #
- # @example Create a list data type with field description
- # Arrow::ListDataType.new(name: "visible", type: :boolean)
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the list data
- # type. It must have `:field` value.
- #
- # @option description [Arrow::Field, Hash] :field The field of
- # the list data type. You can also specify field description
- # by `Hash`.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @example Create a list data type with {Arrow::Field}
- # visible_field = Arrow::Field.new("visible", :boolean)
- # Arrow::ListDataType.new(field: visible_field)
- #
- # @example Create a list data type with field description
- # Arrow::ListDataType.new(field: {name: "visible", type: :boolean})
- #
- # @overload initialize(data_type)
- #
- # @param data_type [Arrow::DataType, String, Symbol,
- # ::Array<String>, ::Array<Symbol>, Hash] The element data
- # type of the list data type. A field is created with the
- # default name `"item"` from the data type automatically.
- #
- # See {Arrow::DataType.resolve} how to specify data type.
- #
- # @example Create a list data type with {Arrow::DataType}
- # Arrow::ListDataType.new(Arrow::BooleanDataType.new)
- #
- # @example Create a list data type with data type name as String
- # Arrow::ListDataType.new("boolean")
- #
- # @example Create a list data type with data type name as Symbol
- # Arrow::ListDataType.new(:boolean)
- #
- # @example Create a list data type with data type as Array
- # Arrow::ListDataType.new([:time32, :milli])
- def initialize(arg)
- data_type = resolve_data_type(arg)
- if data_type
- field = Field.new(default_field_name, data_type)
- else
- field = resolve_field(arg)
- end
- initialize_raw(field)
- end
-
- private
- def resolve_data_type(arg)
- case arg
- when DataType, String, Symbol, ::Array
- DataType.resolve(arg)
- when Hash
- return nil if arg[:name]
- return nil unless arg[:type]
- DataType.resolve(arg)
- else
- nil
- end
- end
-
- def default_field_name
- "item"
- end
-
- def resolve_field(arg)
- if arg.is_a?(Hash) and arg.key?(:field)
- description = arg
- arg = description[:field]
- end
- if arg.is_a?(Hash)
- field_description = arg
- Field.new(field_description)
- else
- arg
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/loader.rb b/ruby/red-arrow/lib/arrow/loader.rb
deleted file mode 100644
index 81a4c20..0000000
--- a/ruby/red-arrow/lib/arrow/loader.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow/block-closable"
-
-module Arrow
- class Loader < GObjectIntrospection::Loader
- class << self
- def load
- super("Arrow", Arrow)
- end
- end
-
- private
- def post_load(repository, namespace)
- require_libraries
- require_extension_library
- end
-
- def require_libraries
- require "arrow/column-containable"
- require "arrow/field-containable"
- require "arrow/generic-filterable"
- require "arrow/generic-takeable"
- require "arrow/record-containable"
-
- require "arrow/array"
- require "arrow/array-builder"
- require "arrow/bigdecimal-extension"
- require "arrow/buffer"
- require "arrow/chunked-array"
- require "arrow/column"
- require "arrow/compression-type"
- require "arrow/csv-loader"
- require "arrow/csv-read-options"
- require "arrow/data-type"
- require "arrow/date32-array"
- require "arrow/date32-array-builder"
- require "arrow/date64-array"
- require "arrow/date64-array-builder"
- require "arrow/decimal128"
- require "arrow/decimal128-array"
- require "arrow/decimal128-array-builder"
- require "arrow/decimal128-data-type"
- require "arrow/decimal256"
- require "arrow/decimal256-array"
- require "arrow/decimal256-array-builder"
- require "arrow/decimal256-data-type"
- require "arrow/dense-union-data-type"
- require "arrow/dictionary-array"
- require "arrow/dictionary-data-type"
- require "arrow/field"
- require "arrow/file-output-stream"
- require "arrow/fixed-size-binary-array"
- require "arrow/fixed-size-binary-array-builder"
- require "arrow/group"
- require "arrow/list-array-builder"
- require "arrow/list-data-type"
- require "arrow/null-array"
- require "arrow/null-array-builder"
- require "arrow/path-extension"
- require "arrow/record"
- require "arrow/record-batch"
- require "arrow/record-batch-builder"
- require "arrow/record-batch-file-reader"
- require "arrow/record-batch-iterator"
- require "arrow/record-batch-stream-reader"
- require "arrow/rolling-window"
- require "arrow/schema"
- require "arrow/slicer"
- require "arrow/sort-key"
- require "arrow/sort-options"
- require "arrow/sparse-union-data-type"
- require "arrow/struct-array"
- require "arrow/struct-array-builder"
- require "arrow/struct-data-type"
- require "arrow/table"
- require "arrow/table-formatter"
- require "arrow/table-list-formatter"
- require "arrow/table-table-formatter"
- require "arrow/table-loader"
- require "arrow/table-saver"
- require "arrow/tensor"
- require "arrow/time"
- require "arrow/time32-array"
- require "arrow/time32-array-builder"
- require "arrow/time32-data-type"
- require "arrow/time64-array"
- require "arrow/time64-array-builder"
- require "arrow/time64-data-type"
- require "arrow/timestamp-array"
- require "arrow/timestamp-array-builder"
- require "arrow/timestamp-data-type"
- require "arrow/writable"
- end
-
- def require_extension_library
- require "arrow.so"
- end
-
- def load_object_info(info)
- super
-
- klass = @base_module.const_get(rubyish_class_name(info))
- if klass.method_defined?(:close)
- klass.extend(BlockClosable)
- end
- end
-
- def load_method_info(info, klass, method_name)
- case klass.name
- when /Array\z/
- case method_name
- when "values"
- method_name = "values_raw"
- end
- end
-
- case klass.name
- when /Builder\z/
- case method_name
- when "append"
- return
- else
- super
- end
- when "Arrow::StringArray"
- case method_name
- when "get_value"
- method_name = "get_raw_value"
- when "get_string"
- method_name = "get_value"
- end
- super(info, klass, method_name)
- when "Arrow::Date32Array",
- "Arrow::Date64Array",
- "Arrow::Decimal128Array",
- "Arrow::Decimal256Array",
- "Arrow::Time32Array",
- "Arrow::Time64Array",
- "Arrow::TimestampArray"
- case method_name
- when "get_value"
- method_name = "get_raw_value"
- end
- super(info, klass, method_name)
- when "Arrow::Decimal128", "Arrow::Decimal256"
- case method_name
- when "copy"
- method_name = "dup"
- end
- super(info, klass, method_name)
- else
- super
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/null-array-builder.rb b/ruby/red-arrow/lib/arrow/null-array-builder.rb
deleted file mode 100644
index 26e58cc..0000000
--- a/ruby/red-arrow/lib/arrow/null-array-builder.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class NullArrayBuilder
- class << self
- def buildable?(args)
- super and not (args.size == 1 and args[0].is_a?(Integer))
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/null-array.rb b/ruby/red-arrow/lib/arrow/null-array.rb
deleted file mode 100644
index 7426bb3..0000000
--- a/ruby/red-arrow/lib/arrow/null-array.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class NullArray
- def get_value(i)
- nil
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/path-extension.rb b/ruby/red-arrow/lib/arrow/path-extension.rb
deleted file mode 100644
index 7d32672..0000000
--- a/ruby/red-arrow/lib/arrow/path-extension.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class PathExtension
- def initialize(path)
- @path = path
- end
-
- def extract
- basename = ::File.basename(@path)
- components = basename.split(".")
- return {} if components.size == 1
-
- extension = components.last.downcase
- if components.size > 2
- compression = CompressionType.resolve_extension(extension)
- if compression
- {
- format: components[-2].downcase,
- compression: compression,
- }
- else
- {format: extension}
- end
- else
- {format: extension}
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/raw-table-converter.rb b/ruby/red-arrow/lib/arrow/raw-table-converter.rb
deleted file mode 100644
index 41d331f..0000000
--- a/ruby/red-arrow/lib/arrow/raw-table-converter.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class RawTableConverter
- attr_reader :n_rows
- attr_reader :schema
- attr_reader :values
- def initialize(raw_table)
- @raw_table = raw_table
- convert
- end
-
- private
- def convert
- if @raw_table.is_a?(::Array) and @raw_table[0].is_a?(Column)
- fields = @raw_table.collect(&:field)
- @schema = Schema.new(fields)
- @values = @raw_table.collect(&:data)
- else
- fields = []
- @values = []
- @raw_table.each do |name, array|
- array = ArrayBuilder.build(array) if array.is_a?(::Array)
- fields << Field.new(name.to_s, array.value_data_type)
- @values << array
- end
- @schema = Schema.new(fields)
- end
- @n_rows = @values[0].length
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-batch-builder.rb b/ruby/red-arrow/lib/arrow/record-batch-builder.rb
deleted file mode 100644
index dc20312..0000000
--- a/ruby/red-arrow/lib/arrow/record-batch-builder.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class RecordBatchBuilder
- class << self
- # @since 0.12.0
- def build(schema, data)
- builder = new(schema)
- builder.append(data)
- builder.flush
- end
- end
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- def initialize(schema)
- unless schema.is_a?(Schema)
- schema = Schema.new(schema)
- end
- initialize_raw(schema)
- @name_to_index = {}
- schema.fields.each_with_index do |field, i|
- @name_to_index[field.name] = i
- end
- end
-
- # @since 0.12.0
- def [](name_or_index)
- case name_or_index
- when String, Symbol
- name = name_or_index
- self[resolve_name(name)]
- else
- index = name_or_index
- column_builders[index]
- end
- end
-
- # @since 0.12.0
- def append(*values)
- values.each do |value|
- case value
- when Hash
- append_columns(value)
- else
- append_records(value)
- end
- end
- end
-
- # @since 0.12.0
- def append_records(records)
- n = n_columns
- columns = n.times.collect do
- []
- end
- records.each_with_index do |record, nth_record|
- case record
- when nil
- when Hash
- record.each do |name, value|
- nth_column = resolve_name(name)
- next if nth_column.nil?
- columns[nth_column] << value
- end
- else
- record.each_with_index do |value, nth_column|
- columns[nth_column] << value
- end
- end
- columns.each do |column|
- column << nil if column.size != (nth_record + 1)
- end
- end
- columns.each_with_index do |column, i|
- self[i].append(*column)
- end
- end
-
- # @since 0.12.0
- def append_columns(columns)
- columns.each do |name, values|
- self[name].append(*values)
- end
- end
-
- # @since 0.13.0
- def column_builders
- @column_builders ||= n_columns.times.collect do |i|
- get_column_builder(i)
- end
- end
-
- private
- def resolve_name(name)
- @name_to_index[name.to_s]
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-batch-file-reader.rb b/ruby/red-arrow/lib/arrow/record-batch-file-reader.rb
deleted file mode 100644
index 86a757e..0000000
--- a/ruby/red-arrow/lib/arrow/record-batch-file-reader.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class RecordBatchFileReader
- include Enumerable
-
- def each
- n_record_batches.times do |i|
- yield(get_record_batch(i))
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-batch-iterator.rb b/ruby/red-arrow/lib/arrow/record-batch-iterator.rb
deleted file mode 100644
index 4b828c6d..0000000
--- a/ruby/red-arrow/lib/arrow/record-batch-iterator.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class RecordBatchIterator
- alias_method :to_a, :to_list
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-batch-stream-reader.rb b/ruby/red-arrow/lib/arrow/record-batch-stream-reader.rb
deleted file mode 100644
index fa15c80..0000000
--- a/ruby/red-arrow/lib/arrow/record-batch-stream-reader.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class RecordBatchStreamReader
- include Enumerable
-
- def each
- loop do
- record_batch = next_record_batch
- break if record_batch.nil?
- yield(record_batch)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-batch.rb b/ruby/red-arrow/lib/arrow/record-batch.rb
deleted file mode 100644
index e7ebf50..0000000
--- a/ruby/red-arrow/lib/arrow/record-batch.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require "arrow/raw-table-converter"
-
-module Arrow
- class RecordBatch
- include ColumnContainable
- include RecordContainable
- include Enumerable
-
- class << self
- def new(*args)
- n_args = args.size
- case n_args
- when 1
- raw_table_converter = RawTableConverter.new(args[0])
- n_rows = raw_table_converter.n_rows
- schema = raw_table_converter.schema
- values = raw_table_converter.values
- super(schema, n_rows, values)
- when 2
- schema, data = args
- RecordBatchBuilder.build(schema, data)
- when 3
- super
- else
- message = "wrong number of arguments (given #{n_args}, expected 1..3)"
- raise ArgumentError, message
- end
- end
- end
-
- alias_method :each, :each_record
-
- alias_method :size, :n_rows
- alias_method :length, :n_rows
-
- alias_method :[], :find_column
-
- # Converts the record batch to {Arrow::Table}.
- #
- # @return [Arrow::Table]
- #
- # @since 0.12.0
- def to_table
- Table.new(schema, [self])
- end
-
- def respond_to_missing?(name, include_private)
- return true if find_column(name)
- super
- end
-
- def method_missing(name, *args, &block)
- if args.empty?
- column = find_column(name)
- return column if column
- end
- super
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record-containable.rb b/ruby/red-arrow/lib/arrow/record-containable.rb
deleted file mode 100644
index 20c9ac2..0000000
--- a/ruby/red-arrow/lib/arrow/record-containable.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- module RecordContainable
- def each_record(reuse_record: false)
- unless block_given?
- return to_enum(__method__, reuse_record: reuse_record)
- end
-
- if reuse_record
- record = Record.new(self, nil)
- n_rows.times do |i|
- record.index = i
- yield(record)
- end
- else
- n_rows.times do |i|
- yield(Record.new(self, i))
- end
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/record.rb b/ruby/red-arrow/lib/arrow/record.rb
deleted file mode 100644
index 6f83dde..0000000
--- a/ruby/red-arrow/lib/arrow/record.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Record
- attr_reader :container
- attr_accessor :index
- def initialize(container, index)
- @container = container
- @index = index
- end
-
- def [](column_name_or_column_index)
- column = @container.find_column(column_name_or_column_index)
- return nil if column.nil?
- column[@index]
- end
-
- def to_a
- @container.columns.collect do |column|
- column[@index]
- end
- end
-
- def to_h
- attributes = {}
- @container.columns.each do |column|
- attributes[column.name] = column[@index]
- end
- attributes
- end
-
- def respond_to_missing?(name, include_private)
- return true if @container.find_column(name)
- super
- end
-
- def method_missing(name, *args, &block)
- if args.empty?
- column = @container.find_column(name)
- return column[@index] if column
- end
- super
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/rolling-window.rb b/ruby/red-arrow/lib/arrow/rolling-window.rb
deleted file mode 100644
index 1db03bb..0000000
--- a/ruby/red-arrow/lib/arrow/rolling-window.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- # Experimental
- #
- # TODO: Almost codes should be implemented in Apache Arrow C++.
- class RollingWindow
- def initialize(table, size)
- @table = table
- @size = size
- end
-
- def lag(key, diff: 1)
- column = @table[key]
- if @size
- windows = column.each_slice(@size)
- else
- windows = column
- end
- lag_values = [nil] * diff
- windows.each_cons(diff + 1) do |values|
- target = values[0]
- current = values[1]
- if target.nil? or current.nil?
- lag_values << nil
- else
- lag_values << current - target
- end
- end
- ArrayBuilder.build(lag_values)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/schema.rb b/ruby/red-arrow/lib/arrow/schema.rb
deleted file mode 100644
index 03354c8..0000000
--- a/ruby/red-arrow/lib/arrow/schema.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class Schema
- include FieldContainable
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::Schema}.
- #
- # @overload initialize(fields)
- #
- # @param fields [::Array<Arrow::Field, Hash>] The fields of the
- # schema. You can mix {Arrow::Field} and field description in
- # the fields.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @example Create a schema with {Arrow::Field}s
- # visible_field = Arrow::Field.new("visible", :boolean)
- # Arrow::Schema.new([visible_field])
- #
- # @example Create a schema with field descriptions
- # visible_field_description = {
- # name: "visible",
- # data_type: :boolean,
- # }
- # Arrow::Schema.new([visible_field_description])
- #
- # @example Create a schema with {Arrow::Field}s and field descriptions
- # fields = [
- # Arrow::Field.new("visible", :boolean),
- # {
- # name: "count",
- # type: :int32,
- # },
- # ]
- # Arrow::Schema.new(fields)
- #
- # @overload initialize(fields)
- #
- # @param fields [Hash{String, Symbol => Arrow::DataType, Hash}]
- # The pairs of field name and field data type of the schema.
- # You can mix {Arrow::DataType} and data description for field
- # data type.
- #
- # See {Arrow::DataType.new} how to specify data type description.
- #
- # @example Create a schema with fields
- # fields = {
- # "visible" => Arrow::BooleanDataType.new,
- # :count => :int32,
- # :tags => {
- # type: :list,
- # field: {
- # name: "tag",
- # type: :string,
- # },
- # },
- # }
- # Arrow::Schema.new(fields)
- def initialize(fields)
- case fields
- when ::Array
- fields = fields.collect do |field|
- field = Field.new(field) unless field.is_a?(Field)
- field
- end
- when Hash
- fields = fields.collect do |name, data_type|
- Field.new(name, data_type)
- end
- end
- initialize_raw(fields)
- end
-
- alias_method :[], :find_field
-
- alias_method :to_s_raw, :to_s
- def to_s(show_metadata: false)
- to_string_metadata(show_metadata)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/slicer.rb b/ruby/red-arrow/lib/arrow/slicer.rb
deleted file mode 100644
index fa83476..0000000
--- a/ruby/red-arrow/lib/arrow/slicer.rb
+++ /dev/null
@@ -1,454 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- # Experimental
- #
- # TODO: Almost codes should be implemented in Apache Arrow C++.
- class Slicer
- def initialize(table)
- @table = table
- end
-
- def [](column_name)
- column = @table[column_name]
- return nil if column.nil?
- ColumnCondition.new(column)
- end
-
- def respond_to_missing?(name, include_private)
- return true if self[name]
- super
- end
-
- def method_missing(name, *args, &block)
- if args.empty?
- column_condition = self[name]
- return column_condition if column_condition
- end
- super
- end
-
- class Condition
- def evaluate
- message = "Slicer::Condition must define \#evaluate: #{inspect}"
- raise NotImplementedError.new(message)
- end
-
- def &(condition)
- AndCondition.new(self, condition)
- end
-
- def |(condition)
- OrCondition.new(self, condition)
- end
-
- def ^(condition)
- XorCondition.new(self, condition)
- end
- end
-
- class LogicalCondition < Condition
- def initialize(condition1, condition2)
- @condition1 = condition1
- @condition2 = condition2
- end
-
- def evaluate
- values1 = @condition1.evaluate.each
- values2 = @condition2.evaluate.each
- raw_array = []
- begin
- loop do
- value1 = values1.next
- value2 = values2.next
- if value1.nil? or value2.nil?
- raw_array << nil
- else
- raw_array << evaluate_value(value1, value2)
- end
- end
- rescue StopIteration
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class AndCondition < LogicalCondition
- private
- def evaluate_value(value1, value2)
- value1 and value2
- end
- end
-
- class OrCondition < LogicalCondition
- private
- def evaluate_value(value1, value2)
- value1 or value2
- end
- end
-
- class XorCondition < LogicalCondition
- private
- def evaluate_value(value1, value2)
- value1 ^ value2
- end
- end
-
- class ColumnCondition < Condition
- def initialize(column)
- @column = column
- end
-
- def evaluate
- data = @column.data
-
- case @column.data_type
- when BooleanDataType
- data
- else
- if data.n_chunks == 1
- data.get_chunk(0).cast(BooleanDataType.new, nil)
- else
- arrays = data.each_chunk.collect do |chunk|
- chunk.cast(BooleanDataType.new, nil)
- end
- ChunkedArray.new(arrays)
- end
- end
- end
-
- def !@
- NotColumnCondition.new(@column)
- end
-
- def null?
- self == nil
- end
-
- def valid?
- self != nil
- end
-
- def ==(value)
- EqualCondition.new(@column, value)
- end
-
- def !=(value)
- NotEqualCondition.new(@column, value)
- end
-
- def <(value)
- LessCondition.new(@column, value)
- end
-
- def <=(value)
- LessEqualCondition.new(@column, value)
- end
-
- def >(value)
- GreaterCondition.new(@column, value)
- end
-
- def >=(value)
- GreaterEqualCondition.new(@column, value)
- end
-
- def in?(values)
- InCondition.new(@column, values)
- end
-
- def select(&block)
- SelectCondition.new(@column, block)
- end
-
- def reject(&block)
- RejectCondition.new(@column, block)
- end
- end
-
- class NotColumnCondition < Condition
- def initialize(column)
- @column = column
- end
-
- def evaluate
- data = @column.data
- raw_array = []
- data.each_chunk do |chunk|
- if chunk.is_a?(BooleanArray)
- boolean_array = chunk
- else
- boolean_array = chunk.cast(BooleanDataType.new, nil)
- end
- boolean_array.each do |value|
- if value.nil?
- raw_array << value
- else
- raw_array << !value
- end
- end
- end
- BooleanArray.new(raw_array)
- end
-
- def !@
- ColumnCondition.new(@column)
- end
- end
-
- class EqualCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- NotEqualCondition.new(@column, @value)
- end
-
- def evaluate
- case @value
- when nil
- raw_array = @column.collect(&:nil?)
- BooleanArray.new(raw_array)
- else
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value == value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
- end
-
- class NotEqualCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- EqualCondition.new(@column, @value)
- end
-
- def evaluate
- case @value
- when nil
- if @column.n_nulls.zero?
- raw_array = [true] * @column.n_rows
- else
- raw_array = @column.n_rows.times.collect do |i|
- @column.valid?(i)
- end
- end
- BooleanArray.new(raw_array)
- else
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value != value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
- end
-
- class LessCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- GreaterEqualCondition.new(@column, @value)
- end
-
- def evaluate
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value > value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class LessEqualCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- GreaterCondition.new(@column, @value)
- end
-
- def evaluate
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value >= value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class GreaterCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- LessEqualCondition.new(@column, @value)
- end
-
- def evaluate
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value < value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class GreaterEqualCondition < Condition
- def initialize(column, value)
- @column = column
- @value = value
- end
-
- def !@
- LessCondition.new(@column, @value)
- end
-
- def evaluate
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- @value <= value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class InCondition < Condition
- def initialize(column, values)
- @column = column
- @values = values
- end
-
- def !@
- NotInCondition.new(@column, @values)
- end
-
- def evaluate
- values_index = {}
- @values.each do |value|
- values_index[value] = true
- end
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- values_index.key?(value)
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class NotInCondition < Condition
- def initialize(column, values)
- @column = column
- @values = values
- end
-
- def !@
- InCondition.new(@column, @values)
- end
-
- def evaluate
- values_index = {}
- @values.each do |value|
- values_index[value] = true
- end
- raw_array = @column.collect do |value|
- if value.nil?
- nil
- else
- not values_index.key?(value)
- end
- end
- BooleanArray.new(raw_array)
- end
- end
-
- class SelectCondition < Condition
- def initialize(column, block)
- @column = column
- @block = block
- end
-
- def !@
- RejectCondition.new(@column, @block)
- end
-
- def evaluate
- BooleanArray.new(@column.collect(&@block))
- end
- end
-
- class RejectCondition < Condition
- def initialize(column, block)
- @column = column
- @block = block
- end
-
- def !@
- SelectCondition.new(@column, @block)
- end
-
- def evaluate
- raw_array = @column.collect do |value|
- evaluated_value = @block.call(value)
- if evaluated_value.nil?
- nil
- else
- not evaluated_value
- end
- end
- BooleanArray.new(raw_array)
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/sort-key.rb b/ruby/red-arrow/lib/arrow/sort-key.rb
deleted file mode 100644
index 9870272..0000000
--- a/ruby/red-arrow/lib/arrow/sort-key.rb
+++ /dev/null
@@ -1,193 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class SortKey
- class << self
- # Ensure returning suitable {Arrow::SortKey}.
- #
- # @overload resolve(sort_key)
- #
- # Returns the given sort key itself. This is convenient to use
- # this method as {Arrow::SortKey} converter.
- #
- # @param sort_key [Arrow::SortKey] The sort key.
- #
- # @return [Arrow::SortKey] The given sort key itself.
- #
- # @overload resolve(name)
- #
- # Creates a new suitable sort key from column name with
- # leading order mark. See {#initialize} for details about
- # order mark.
- #
- # @return [Arrow::SortKey] A new suitable sort key.
- #
- # @overload resolve(name, order)
- #
- # Creates a new suitable sort key from column name without
- # leading order mark and order. See {#initialize} for details.
- #
- # @return [Arrow::SortKey] A new suitable sort key.
- #
- # @since 4.0.0
- def resolve(name, order=nil)
- return name if name.is_a?(self)
- new(name, order)
- end
-
- # @api private
- def try_convert(value)
- case value
- when Symbol, String
- new(value.to_s, :ascending)
- else
- nil
- end
- end
- end
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- # Creates a new {Arrow::SortKey}.
- #
- # @overload initialize(name)
- #
- # @param name [Symbol, String] The name of the sort column.
- #
- # If `name` is a String, the first character may be processed
- # as the "leading order mark". If the first character is `"+"`
- # or `"-"`, they are processed as a leading order mark. If the
- # first character is processed as a leading order mark, the
- # first character is removed from sort column name and
- # corresponding order is used. `"+"` uses ascending order and
- # `"-"` uses ascending order.
- #
- # If `name` is not a String nor `name` doesn't start with the
- # leading order mark, sort column name is `name` as-is and
- # ascending order is used.
- #
- # @example String without the leading order mark
- # key = Arrow::SortKey.new("count")
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::ASCENDING
- #
- # @example String with the "+" leading order mark
- # key = Arrow::SortKey.new("+count")
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::ASCENDING
- #
- # @example String with the "-" leading order mark
- # key = Arrow::SortKey.new("-count")
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::DESCENDING
- #
- # @example Symbol that starts with "-"
- # key = Arrow::SortKey.new(:"-count")
- # key.name # => "-count"
- # key.order # => Arrow::SortOrder::ASCENDING
- #
- # @overload initialize(name, order)
- #
- # @param name [Symbol, String] The name of the sort column.
- #
- # No leading order mark processing. The given `name` is used
- # as-is.
- #
- # @param order [Symbol, String, Arrow::SortOrder] How to order
- # by this sort key.
- #
- # If this is a Symbol or String, this must be `:ascending`,
- # `"ascending"`, `:asc`, `"asc"`, `:descending`,
- # `"descending"`, `:desc` or `"desc"`.
- #
- # @example No leading order mark processing
- # key = Arrow::SortKey.new("-count", :ascending)
- # key.name # => "-count"
- # key.order # => Arrow::SortOrder::ASCENDING
- #
- # @example Order by abbreviated name with Symbol
- # key = Arrow::SortKey.new("count", :desc)
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::DESCENDING
- #
- # @example Order by String
- # key = Arrow::SortKey.new("count", "descending")
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::DESCENDING
- #
- # @example Order by Arrow::SortOrder
- # key = Arrow::SortKey.new("count", Arrow::SortOrder::DESCENDING)
- # key.name # => "count"
- # key.order # => Arrow::SortOrder::DESCENDING
- #
- # @since 4.0.0
- def initialize(name, order=nil)
- name, order = normalize_name(name, order)
- order = normalize_order(order) || :ascending
- initialize_raw(name, order)
- end
-
- # @return [String] The string representation of this sort key. You
- # can use recreate {Arrow::SortKey} by
- # `Arrow::SortKey.new(key.to_s)`.
- #
- # @example Recreate Arrow::SortKey
- # key = Arrow::SortKey.new("-count")
- # key.to_s # => "-count"
- # key == Arrow::SortKey.new(key.to_s) # => true
- #
- # @since 4.0.0
- def to_s
- if order == SortOrder::ASCENDING
- "+#{name}"
- else
- "-#{name}"
- end
- end
-
- private
- def normalize_name(name, order)
- case name
- when Symbol
- return name.to_s, order
- when String
- return name, order if order
- if name.start_with?("-")
- return name[1..-1], order || :descending
- elsif name.start_with?("+")
- return name[1..-1], order || :ascending
- else
- return name, order
- end
- else
- return name, order
- end
- end
-
- def normalize_order(order)
- case order
- when :asc, "asc"
- :ascending
- when :desc, "desc"
- :descending
- else
- order
- end
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/sort-options.rb b/ruby/red-arrow/lib/arrow/sort-options.rb
deleted file mode 100644
index a7c2d64..0000000
--- a/ruby/red-arrow/lib/arrow/sort-options.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class SortOptions
- class << self
- # @api private
- def try_convert(value)
- case value
- when Symbol, String
- new(value)
- when ::Array
- new(*value)
- else
- nil
- end
- end
- end
-
- alias_method :initialize_raw, :initialize
- private :initialize_raw
- # @param sort_keys [::Array<String, Symbol, Arrow::SortKey>] The
- # sort keys to be used. See {Arrow::SortKey.resolve} how to
- # resolve each sort key in `sort_keys`.
- #
- # You can add more sort keys by {#add_sort_key} later.
- #
- # @example No initial sort keys
- # options = Arrow::SortOptions.new
- # options.sort_keys # => []
- #
- # @example String sort keys
- # options = Arrow::SortOptions.new("count", "-age")
- # options.sort_keys.collect(&:to_s) # => ["+count", "-age"]
- #
- # @example Symbol sort keys
- # options = Arrow::SortOptions.new(:count, :age)
- # options.sort_keys.collect(&:to_s) # => ["+count", "+age"]
- #
- # @example Mixed sort keys
- # options = Arrow::SortOptions.new(:count, "-age")
- # options.sort_keys.collect(&:to_s) # => ["+count", "-age"]
- #
- # @since 4.0.0
- def initialize(*sort_keys)
- initialize_raw
- sort_keys.each do |sort_key|
- add_sort_key(sort_key)
- end
- end
-
- # @api private
- alias_method :add_sort_key_raw, :add_sort_key
- # Add a sort key.
- #
- # @return [void]
- #
- # @overload add_sort_key(key)
- #
- # @param key [Arrow::SortKey] The sort key to be added.
- #
- # @example Add a key to sort by "price" column in descending order
- # options = Arrow::SortOptions.new
- # options.add_sort_key(Arrow::SortKey.new(:price, :descending))
- # options.sort_keys.collect(&:to_s) # => ["-price"]
- #
- # @overload add_sort_key(name)
- #
- # @param name [Symbol, String] The sort key name to be
- # added. See also {Arrow::SortKey#initialize} for the leading
- # order mark for String name.
- #
- # @example Add a key to sort by "price" column in descending order
- # options = Arrow::SortOptions.new
- # options.add_sort_key("-price")
- # options.sort_keys.collect(&:to_s) # => ["-price"]
- #
- # @overload add_sort_key(name, order)
- #
- # @param name [Symbol, String] The sort key name.
- #
- # @param order [Symbol, String, Arrow::SortOrder] The sort
- # order. See {Arrow::SortKey#initialize} for details.
- #
- # @example Add a key to sort by "price" column in descending order
- # options = Arrow::SortOptions.new
- # options.add_sort_key("price", :desc)
- # options.sort_keys.collect(&:to_s) # => ["-price"]
- #
- # @since 4.0.0
- def add_sort_key(name, order=nil)
- add_sort_key_raw(SortKey.resolve(name, order))
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/sparse-union-data-type.rb b/ruby/red-arrow/lib/arrow/sparse-union-data-type.rb
deleted file mode 100644
index 14f3e5a..0000000
--- a/ruby/red-arrow/lib/arrow/sparse-union-data-type.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class SparseUnionDataType
- alias_method :initialize_raw, :initialize
- private :initialize_raw
-
- # Creates a new {Arrow::SparseUnionDataType}.
- #
- # @overload initialize(fields, type_codes)
- #
- # @param fields [::Array<Arrow::Field, Hash>] The fields of the
- # sparse union data type. You can mix {Arrow::Field} and field
- # description in the fields.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @param type_codes [::Array<Integer>] The IDs that indicates
- # corresponding fields.
- #
- # @example Create a sparse union data type for `{2: visible, 9: count}`
- # fields = [
- # Arrow::Field.new("visible", :boolean),
- # {
- # name: "count",
- # type: :int32,
- # },
- # ]
- # Arrow::SparseUnionDataType.new(fields, [2, 9])
- #
- # @overload initialize(description)
- #
- # @param description [Hash] The description of the sparse union
- # data type. It must have `:fields` and `:type_codes` values.
- #
- # @option description [::Array<Arrow::Field, Hash>] :fields The
- # fields of the sparse union data type. You can mix
- # {Arrow::Field} and field description in the fields.
- #
- # See {Arrow::Field.new} how to specify field description.
- #
- # @option description [::Array<Integer>] :type_codes The IDs
- # that indicates corresponding fields.
- #
- # @example Create a sparse union data type for `{2: visible, 9: count}`
- # fields = [
- # Arrow::Field.new("visible", :boolean),
- # {
- # name: "count",
- # type: :int32,
- # },
- # ]
- # Arrow::SparseUnionDataType.new(fields: fields,
- # type_codes: [2, 9])
- def initialize(*args)
- n_args = args.size
- case n_args
- when 1
- description = args[0]
- fields = description[:fields]
- type_codes = description[:type_codes]
- when 2
- fields, type_codes = args
- else
- message = "wrong number of arguments (given, #{n_args}, expected 1..2)"
- raise ArgumentError, message
- end
- fields = fields.collect do |field|
- field = Field.new(field) unless field.is_a?(Field)
- field
- end
- initialize_raw(fields, type_codes)
- end
- end
-end
diff --git a/ruby/red-arrow/lib/arrow/struct-array-builder.rb b/ruby/red-arrow/lib/arrow/struct-array-builder.rb
deleted file mode 100644
index ce88316..0000000
--- a/ruby/red-arrow/lib/arrow/struct-array-builder.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-module Arrow
- class StructArrayBuilder
- class << self
- def build(data_type, values)
- builder = new(data_type)
- builder.build(values)
- end
- end
-
- def [](index_or_name)
- find_field_builder(index_or_name)
- end
-
- def find_field_builder(index_or_name)
- case index_or_name
- when String, Symbol
- name = index_or_name
- cached_name_to_builder[name.to_s]
- else
- index = index_or_name
- cached_field_builders[index]
- end
- end
-
- alias_method :append_value_raw, :append_value
-
- # @overload append_value
- #
- # Starts appending a struct record. You need to append values of
- # fields.
- #
- # @overload append_value(value)
- #
- # Appends a struct record including values of fields.
- #
- # @param value [nil, ::Array, Hash] The struct record value.
- #
- # If this is `nil`, the struct record is null.
- #
- # If this is `Array` or `Hash`, they are values of fields.
- #
- # @since 0.12.0
- def append_value(*args)
- n_args = args.size
-
- case n_args
- when 0
- append_value_raw
- when 1
- value = args[0]
- case value
- when nil
... 17016 lines suppressed ...