├── .asf.yaml ├── .clang-format ├── .clang-tidy ├── .cmake-format ├── .env ├── .flake8 ├── .gitattributes ├── .github └── workflows │ ├── benchmarks.yaml │ ├── build-and-test-device.yaml │ ├── build-and-test-ipc.yaml │ ├── build-and-test.yaml │ ├── clang-tidy.yaml │ ├── coverage.yaml │ ├── dev.yaml │ ├── docker-build.yaml │ ├── examples.yaml │ ├── integration.yaml │ ├── packaging.yaml │ ├── python-wheels.yaml │ ├── python.yaml │ ├── r-check.yaml │ └── verify.yaml ├── .gitignore ├── .isort.cfg ├── .pre-commit-config.yaml ├── CHANGELOG.md ├── CMakeLists.txt ├── CMakePresets.json ├── CMakeUserPresets.json.example ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── ci ├── docker │ ├── alpine.dockerfile │ ├── archlinux.dockerfile │ ├── centos7.dockerfile │ ├── fedora.dockerfile │ ├── integration.dockerfile │ └── ubuntu.dockerfile └── scripts │ ├── build-arrow-cpp-minimal.sh │ ├── build-docs.sh │ ├── build-with-meson.sh │ ├── bundle.py │ ├── coverage.sh │ ├── run-clang-tidy.sh │ ├── test-python-wheels.sh │ └── test_bundle.py ├── cmake └── config.cmake.in ├── dev ├── benchmarks │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── README.md │ ├── apidoc │ │ ├── .gitignore │ │ └── Doxyfile │ ├── asv.conf.json │ ├── benchmark-report.qmd │ ├── benchmark-run-all.sh │ ├── benchmarks.Rproj │ ├── c │ │ ├── array_benchmark.cc │ │ ├── ipc_benchmark.cc │ │ └── schema_benchmark.cc │ ├── generate-fixtures.py │ ├── meson.build │ └── python │ │ ├── __init__.py │ │ ├── array.py │ │ ├── ipc.py │ │ └── schema.py ├── release │ ├── .env.example │ ├── .gitignore │ ├── 01-prepare.sh │ ├── 02-sign.sh │ ├── 03-source.sh │ ├── README.md │ ├── check-rat-report.py │ ├── post-01-upload.sh │ ├── post-02-bump-versions.sh │ ├── rat_exclude_files.txt │ ├── release_tools.py │ ├── run-rat.sh │ ├── source_build.sh │ ├── test_release_tools.py │ ├── utils-prepare.sh │ └── verify-release-candidate.sh ├── update_fbs.sh └── update_vendored_flatcc.sh ├── docker-compose.yml ├── docs ├── .gitignore ├── README.md ├── requirements.txt └── source │ ├── conf.py │ ├── getting-started │ ├── cpp.md │ └── index.rst │ ├── index.rst │ ├── reference │ ├── c.rst │ ├── cpp.rst │ ├── device.rst │ ├── index.rst │ ├── ipc.rst │ ├── python │ │ ├── advanced.rst │ │ ├── array-stream.rst │ │ ├── array.rst │ │ ├── index.rst │ │ └── schema.rst │ ├── r.rst │ └── testing.rst │ └── roadmap.md ├── examples ├── cmake-ipc │ ├── CMakeLists.txt │ ├── README.md │ ├── invalid.arrows │ ├── schema-valid.arrows │ └── src │ │ ├── app.c │ │ ├── library.c │ │ └── library.h ├── cmake-minimal │ ├── CMakeLists.txt │ ├── README.md │ └── src │ │ ├── app.c │ │ ├── library.c │ │ └── library.h ├── cmake-scenarios │ ├── CMakeLists.txt │ ├── README.md │ ├── build.sh │ ├── run.sh │ └── src │ │ └── app.cpp ├── linesplitter │ ├── CMakeLists.txt │ ├── linesplitter.cc │ ├── linesplitter.h │ └── linesplitter_test.cc ├── meson-minimal │ ├── README.md │ ├── meson.build │ ├── src │ │ └── app.cc │ └── subprojects │ │ └── nanoarrow.wrap ├── python-package │ ├── .gitignore │ ├── README.md │ ├── meson.build │ ├── pyproject.toml │ ├── src │ │ └── nanoarrow_python_demo │ │ │ └── schema_printer.c │ └── subprojects │ │ └── nanoarrow.wrap ├── vendored-ipc │ ├── README.md │ ├── invalid.arrows │ ├── schema-valid.arrows │ └── src │ │ ├── app.c │ │ ├── library.c │ │ ├── library.h │ │ └── nanoarrow │ │ └── README.md └── vendored-minimal │ ├── README.md │ └── src │ ├── .gitignore │ ├── app.c │ ├── library.c │ ├── library.h │ ├── nanoarrow.c │ └── nanoarrow │ └── nanoarrow.h ├── meson.build ├── meson.options ├── python ├── .coveragerc ├── .gitignore ├── MANIFEST.in ├── README.ipynb ├── README.md ├── bootstrap.py ├── generate_dist.py ├── generate_type_stubs.sh ├── meson.build ├── pyproject.toml ├── src │ └── nanoarrow │ │ ├── __init__.py │ │ ├── _array.pxd │ │ ├── _array.pyi │ │ ├── _array.pyx │ │ ├── _array_stream.pyi │ │ ├── _array_stream.pyx │ │ ├── _buffer.pxd │ │ ├── _buffer.pyi │ │ ├── _buffer.pyx │ │ ├── _device.pxd │ │ ├── _device.pyi │ │ ├── _device.pyx │ │ ├── _ipc_lib.pyi │ │ ├── _ipc_lib.pyx │ │ ├── _repr_utils.py │ │ ├── _schema.pxd │ │ ├── _schema.pyi │ │ ├── _schema.pyx │ │ ├── _static_version.py │ │ ├── _types.pxd │ │ ├── _types.pyi │ │ ├── _types.pyx │ │ ├── _utils.pxd │ │ ├── _utils.pyi │ │ ├── _utils.pyx │ │ ├── _version.py │ │ ├── array.py │ │ ├── array_stream.py │ │ ├── c_array.py │ │ ├── c_array_stream.py │ │ ├── c_buffer.py │ │ ├── c_schema.py │ │ ├── device.py │ │ ├── dlpack_abi.h │ │ ├── extension.py │ │ ├── extension_canonical.py │ │ ├── ipc.py │ │ ├── iterator.py │ │ ├── meson.build │ │ ├── nanoarrow_dlpack.pxd │ │ ├── schema.py │ │ └── visitor.py ├── subprojects │ ├── arrow-nanoarrow │ ├── flatcc.wrap │ ├── packagefiles │ │ └── flatcc │ │ │ └── meson.build │ └── zstd.wrap └── tests │ ├── conftest.py │ ├── test_array.py │ ├── test_array_stream.py │ ├── test_c_array.py │ ├── test_c_array_stream.py │ ├── test_c_buffer.py │ ├── test_c_buffer_view.py │ ├── test_c_schema.py │ ├── test_c_schema_view.py │ ├── test_capsules.py │ ├── test_device.py │ ├── test_dlpack.py │ ├── test_extension.py │ ├── test_extension_canonical.py │ ├── test_ipc.py │ ├── test_iterator.py │ ├── test_nanoarrow.py │ ├── test_schema.py │ ├── test_version.py │ └── test_visitor.py ├── r ├── .Rbuildignore ├── .covrignore ├── .gitignore ├── DESCRIPTION ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R │ ├── altrep.R │ ├── array-stream.R │ ├── array.R │ ├── as-array.R │ ├── buffer.R │ ├── convert-array-stream.R │ ├── convert-array.R │ ├── extension-vctrs.R │ ├── extension.R │ ├── infer-ptype.R │ ├── ipc.R │ ├── nanoarrow-package.R │ ├── pkg-arrow.R │ ├── pointers.R │ ├── schema.R │ ├── type.R │ ├── util.R │ ├── vctr.R │ └── zzz.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── bootstrap.R ├── configure ├── configure.win ├── cran-comments.md ├── inst │ └── include │ │ └── nanoarrow │ │ └── r.h ├── man │ ├── array_stream_set_finalizer.Rd │ ├── as_nanoarrow_array.Rd │ ├── as_nanoarrow_array_stream.Rd │ ├── as_nanoarrow_buffer.Rd │ ├── as_nanoarrow_schema.Rd │ ├── as_nanoarrow_vctr.Rd │ ├── basic_array_stream.Rd │ ├── convert_array.Rd │ ├── convert_array_stream.Rd │ ├── example_ipc_stream.Rd │ ├── infer_nanoarrow_ptype.Rd │ ├── infer_nanoarrow_ptype_extension.Rd │ ├── na_type.Rd │ ├── na_vctrs.Rd │ ├── nanoarrow-package.Rd │ ├── nanoarrow_array_init.Rd │ ├── nanoarrow_buffer_init.Rd │ ├── nanoarrow_extension_array.Rd │ ├── nanoarrow_extension_spec.Rd │ ├── nanoarrow_pointer_is_valid.Rd │ ├── nanoarrow_version.Rd │ └── read_nanoarrow.Rd ├── nanoarrow.Rproj ├── src │ ├── .gitignore │ ├── Makevars.in │ ├── Makevars.ucrt │ ├── Makevars.win │ ├── altrep.c │ ├── altrep.h │ ├── array.c │ ├── array.h │ ├── array_stream.c │ ├── array_stream.h │ ├── array_view.c │ ├── array_view.h │ ├── as_array.c │ ├── buffer.c │ ├── buffer.h │ ├── convert.c │ ├── convert.h │ ├── convert_array.c │ ├── convert_array_stream.c │ ├── infer_ptype.c │ ├── init.c │ ├── ipc.c │ ├── materialize.c │ ├── materialize.h │ ├── materialize_blob.h │ ├── materialize_chr.h │ ├── materialize_common.h │ ├── materialize_date.h │ ├── materialize_dbl.h │ ├── materialize_difftime.h │ ├── materialize_int.h │ ├── materialize_int64.h │ ├── materialize_lgl.h │ ├── materialize_posixct.h │ ├── materialize_unspecified.h │ ├── nanoarrow_cpp.cc │ ├── pointers.c │ ├── schema.c │ ├── schema.h │ ├── util.c │ ├── util.h │ ├── vctr.c │ └── version.c ├── tests │ ├── testthat.R │ └── testthat │ │ ├── _snaps │ │ ├── array-stream.md │ │ ├── array.md │ │ ├── as-array.md │ │ └── buffer.md │ │ ├── test-altrep.R │ │ ├── test-array-stream.R │ │ ├── test-array.R │ │ ├── test-as-array.R │ │ ├── test-buffer.R │ │ ├── test-convert-array-stream.R │ │ ├── test-convert-array.R │ │ ├── test-extension-vctrs.R │ │ ├── test-extension.R │ │ ├── test-infer-ptype.R │ │ ├── test-ipc.R │ │ ├── test-nanoarrow-package.R │ │ ├── test-pkg-arrow.R │ │ ├── test-pointers.R │ │ ├── test-schema.R │ │ ├── test-type.R │ │ ├── test-util.R │ │ └── test-vctr.R └── tools │ ├── make-callentries.R │ └── test_zstd.c ├── src ├── apidoc │ ├── .gitignore │ └── Doxyfile ├── apps │ └── dump_stream.c └── nanoarrow │ ├── common │ ├── array.c │ ├── array_stream.c │ ├── array_stream_test.cc │ ├── array_test.cc │ ├── buffer_test.cc │ ├── inline_array.h │ ├── inline_buffer.h │ ├── inline_types.h │ ├── schema.c │ ├── schema_test.cc │ ├── utils.c │ └── utils_test.cc │ ├── device │ ├── cuda.c │ ├── cuda_test.cc │ ├── device.c │ ├── device_hpp_test.cc │ ├── device_test.cc │ ├── metal.cc │ ├── metal_impl.cc │ ├── metal_impl.h │ └── metal_test.cc │ ├── hpp │ ├── array_stream.hpp │ ├── array_stream_test.cc │ ├── buffer.hpp │ ├── buffer_test.cc │ ├── exception.hpp │ ├── exception_test.cc │ ├── operators.hpp │ ├── unique.hpp │ ├── unique_test.cc │ ├── view.hpp │ └── view_test.cc │ ├── integration │ ├── c_data_integration.cc │ ├── c_data_integration.h │ ├── c_data_integration_test.cc │ └── ipc_integration.cc │ ├── ipc │ ├── codecs.c │ ├── codecs_test.cc │ ├── decoder.c │ ├── decoder_test.cc │ ├── encoder.c │ ├── encoder_test.cc │ ├── files_test.cc │ ├── flatcc_generated.h │ ├── ipc_hpp_test.cc │ ├── reader.c │ ├── reader_test.cc │ ├── writer.c │ └── writer_test.cc │ ├── meson.build │ ├── nanoarrow.h │ ├── nanoarrow.hpp │ ├── nanoarrow_config.h.in │ ├── nanoarrow_device.h │ ├── nanoarrow_device.hpp │ ├── nanoarrow_gtest_util.hpp │ ├── nanoarrow_ipc.h │ ├── nanoarrow_ipc.hpp │ ├── nanoarrow_testing.hpp │ └── testing │ ├── testing.cc │ └── testing_test.cc ├── subprojects ├── flatcc.wrap ├── google-benchmark.wrap ├── gtest.wrap ├── metal-cpp.wrap ├── nlohmann_json.wrap ├── packagefiles │ ├── flatcc │ │ └── meson.build │ └── metal-cpp │ │ └── meson.build ├── zlib.wrap └── zstd.wrap ├── thirdparty ├── flatcc │ ├── LICENSE │ ├── include │ │ └── flatcc │ │ │ ├── flatcc_accessors.h │ │ │ ├── flatcc_alloc.h │ │ │ ├── flatcc_assert.h │ │ │ ├── flatcc_builder.h │ │ │ ├── flatcc_emitter.h │ │ │ ├── flatcc_endian.h │ │ │ ├── flatcc_epilogue.h │ │ │ ├── flatcc_flatbuffers.h │ │ │ ├── flatcc_identifier.h │ │ │ ├── flatcc_iov.h │ │ │ ├── flatcc_portable.h │ │ │ ├── flatcc_prologue.h │ │ │ ├── flatcc_refmap.h │ │ │ ├── flatcc_rtconfig.h │ │ │ ├── flatcc_types.h │ │ │ ├── flatcc_verifier.h │ │ │ └── portable │ │ │ ├── paligned_alloc.h │ │ │ ├── pattributes.h │ │ │ ├── pdiagnostic.h │ │ │ ├── pdiagnostic_pop.h │ │ │ ├── pdiagnostic_push.h │ │ │ ├── pendian.h │ │ │ ├── pendian_detect.h │ │ │ ├── pinline.h │ │ │ ├── pinttypes.h │ │ │ ├── pmemaccess.h │ │ │ ├── portable.h │ │ │ ├── portable_basic.h │ │ │ ├── prestrict.h │ │ │ ├── pstatic_assert.h │ │ │ ├── pstdalign.h │ │ │ ├── pstdint.h │ │ │ ├── punaligned.h │ │ │ ├── pversion.h │ │ │ └── pwarnings.h │ └── src │ │ └── runtime │ │ ├── builder.c │ │ ├── emitter.c │ │ ├── refmap.c │ │ └── verifier.c ├── googletest │ └── CMakeLists.txt ├── nlohmann_json │ └── CMakeLists.txt └── zlib │ └── CMakeLists.txt └── valgrind.supp /.asf.yaml: -------------------------------------------------------------------------------- 1 | 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | github: 20 | description: "Helpers for Arrow C Data & Arrow C Stream interfaces" 21 | homepage: https://arrow.apache.org/nanoarrow 22 | enabled_merge_buttons: 23 | squash: true 24 | features: 25 | issues: true 26 | discussions: true 27 | labels: 28 | - arrow 29 | protected_branches: 30 | main: {} 31 | 32 | notifications: 33 | commits: commits@arrow.apache.org 34 | discussions: user@arrow.apache.org 35 | issues_status: issues@arrow.apache.org 36 | issues: github@arrow.apache.org 37 | pullrequests: github@arrow.apache.org 38 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | --- 18 | BasedOnStyle: Google 19 | ColumnLimit: 90 20 | DerivePointerAlignment: false 21 | IncludeBlocks: Preserve 22 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | --- 18 | # Disable valist, it's buggy: https://github.com/llvm/llvm-project/issues/40656 19 | # Disable DeprecatedOrUnsafeBufferHandling because it suggests we replace 20 | # memset and memcpy with memset_s() and memcpy_s() if compiled with C11. Because 21 | # we also support C99, we can't blindly replace those calls. 22 | Checks: '-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' 23 | FormatStyle: google 24 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # All of the following environment variables are required to set default values 19 | # for the parameters in docker-compose.yml. 20 | 21 | # Default repository to pull and push images from 22 | REPO=ghcr.io/apache/arrow-nanoarrow 23 | 24 | # Linux platform (i.e., the dockerfile to use from ci/docker) 25 | NANOARROW_PLATFORM=alpine 26 | NANOARROW_ARCH=amd64 27 | 28 | # Source directory (so that the docker compose app can be used on another checkout) 29 | NANOARROW_DOCKER_SOURCE_DIR="." 30 | 31 | # By default, verify HEAD 32 | NANOARROW_VERIFY_ARGS="" 33 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [flake8] 19 | max-line-length = 88 20 | extend-ignore = E203 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | thirdparty/* linguist-vendored 19 | python/src/nanoarrow/*.pxi linguist-generated 20 | -------------------------------------------------------------------------------- /.github/workflows/benchmarks.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: benchmarks 19 | 20 | on: 21 | push: 22 | branches: 23 | - main 24 | pull_request: 25 | branches: 26 | - main 27 | paths: 28 | - '.github/workflows/benchmarks.yaml' 29 | - 'dev/benchmarks/**' 30 | 31 | permissions: 32 | contents: read 33 | 34 | jobs: 35 | benchmarks: 36 | 37 | runs-on: ubuntu-latest 38 | 39 | steps: 40 | - uses: actions/checkout@v4 41 | - uses: actions/setup-python@v5 42 | with: 43 | cache: 'pip' 44 | 45 | - name: Install Python dependencies 46 | run: | 47 | pip install pyarrow numpy asv 48 | 49 | - name: Genereate fixtures 50 | run: | 51 | cd dev/benchmarks 52 | python generate-fixtures.py 53 | 54 | - name: Check C benchmarks 55 | run: | 56 | cd dev/benchmarks 57 | ./benchmark-run-all.sh 58 | 59 | - name: Check Python benchmarks 60 | run: | 61 | cd dev/benchmarks 62 | asv machine --yes 63 | asv run --quick --verbose ${{ github.sha }}^! 64 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: coverage 19 | 20 | on: 21 | push: 22 | branches: 23 | - main 24 | pull_request: 25 | branches: 26 | - main 27 | paths: 28 | - '.github/workflows/coverage.yaml' 29 | - 'ci/scripts/coverage.sh' 30 | - 'ci/docker/ubuntu.dockerfile' 31 | - 'docker-compose.yml' 32 | - 'CMakeLists.txt' 33 | - 'src/nanoarrow/**' 34 | - 'r/**' 35 | 36 | jobs: 37 | coverage: 38 | 39 | runs-on: ubuntu-latest 40 | 41 | steps: 42 | - uses: actions/checkout@v4 43 | 44 | - name: Calculate code coverage 45 | run: | 46 | echo "::group::Docker Pull" 47 | docker compose run --rm -e GITHUB_ACTIONS coverage 48 | 49 | - name: Upload coverage artifacts 50 | if: always() 51 | uses: actions/upload-artifact@main 52 | with: 53 | name: nanarrow-coverage 54 | path: _coverage 55 | 56 | - name: Upload coverage to codecov 57 | uses: codecov/codecov-action@v3 58 | with: 59 | files: '_coverage/coverage.info,_coverage/r_coverage.json,_coverage/python_coverage.xml' 60 | -------------------------------------------------------------------------------- /.github/workflows/dev.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Dev 19 | 20 | on: 21 | push: 22 | branches: 23 | - main 24 | pull_request: 25 | branches: 26 | - main 27 | 28 | permissions: 29 | contents: read 30 | 31 | jobs: 32 | pre-commit: 33 | name: "pre-commit" 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: actions/checkout@v4 37 | with: 38 | fetch-depth: 0 39 | persist-credentials: false 40 | - uses: actions/setup-python@v5 41 | with: 42 | python-version: '3.x' 43 | - name: pre-commit (cache) 44 | uses: actions/cache@v4 45 | with: 46 | path: ~/.cache/pre-commit 47 | key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} 48 | - name: pre-commit (--all-files) 49 | run: | 50 | python -m pip install pre-commit 51 | pre-commit run --show-diff-on-failure --color=always --all-files 52 | -------------------------------------------------------------------------------- /.github/workflows/integration.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: integration 19 | 20 | on: 21 | push: 22 | branches: 23 | - main 24 | - 'maint-*' 25 | pull_request: 26 | paths: 27 | - .github/workflows/integration.yaml 28 | - ci/docker/integration.dockerfile 29 | - docker-compose.yml 30 | schedule: 31 | - cron: '5 0 * * 0' 32 | 33 | permissions: 34 | contents: read 35 | 36 | concurrency: 37 | group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} 38 | cancel-in-progress: true 39 | 40 | jobs: 41 | integration: 42 | runs-on: ubuntu-latest 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - name: Run integration tests 47 | run: | 48 | echo "::group::Docker Build" 49 | docker compose run --rm -e GITHUB_ACTIONS integration 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | _coverage/ 19 | build/ 20 | scratch/ 21 | out/ 22 | arrow-hpp 23 | .DS_Store 24 | CMakeUserPresets.json 25 | .vscode 26 | .Rproj.user 27 | .cache 28 | *.swp 29 | __pycache__ 30 | 31 | # meson subprojects - wrap files need to be kept to let meson download 32 | # dependencies as needed, but dependencies themselves should not be versioned 33 | subprojects/* 34 | !subprojects/packagefiles 35 | !subprojects/*.wrap 36 | python/subprojects/* 37 | !python/subprojects/packagefiles 38 | !python/subprojects/*.wrap 39 | 40 | compile_commands.json 41 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [settings] 19 | multi_line_output = 3 20 | include_trailing_comma = True 21 | force_grid_wrap = 0 22 | use_parentheses = True 23 | line_length = 88 24 | -------------------------------------------------------------------------------- /CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "cmakeMinimumRequired": { 4 | "major": 3, 5 | "minor": 21, 6 | "patch": 0 7 | }, 8 | "configurePresets": [ 9 | { 10 | "name": "default", 11 | "displayName": "Default Config", 12 | "binaryDir": "${sourceDir}/build", 13 | "cacheVariables": { 14 | "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" 15 | } 16 | }, 17 | { 18 | "name": "default-with-tests", 19 | "inherits": ["default"], 20 | "displayName": "Default with tests", 21 | "cacheVariables": { 22 | "CMAKE_BUILD_TYPE": "Debug", 23 | "NANOARROW_BUILD_TESTS": "ON" 24 | } 25 | }, 26 | { 27 | "name": "default-with-benchmarks", 28 | "inherits": ["default"], 29 | "displayName": "Default with benchmarks", 30 | "cacheVariables": { 31 | "CMAKE_BUILD_TYPE": "Release", 32 | "NANOARROW_BUILD_BENCHMARKS": "ON" 33 | } 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /CMakeUserPresets.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "cmakeMinimumRequired": { 4 | "major": 3, 5 | "minor": 21, 6 | "patch": 0 7 | }, 8 | "configurePresets": [ 9 | { 10 | "name": "user-local", 11 | "inherits": ["default-with-tests"], 12 | "displayName": "(user) local build", 13 | "cacheVariables": { 14 | "Arrow_DIR": "/path/to/arrow/dist/lib/cmake/arrow" 15 | } 16 | } 17 | ], 18 | "testPresets": [ 19 | { 20 | "name": "user-test-preset", 21 | "description": "", 22 | "displayName": "(user) test preset", 23 | "configurePreset": "user-local", 24 | "environment": { 25 | "CTEST_OUTPUT_ON_FAILURE": "1" 26 | } 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Arrow nanoarrow 2 | Copyright 2023 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /ci/docker/alpine.dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | ARG NANOARROW_ARCH 19 | 20 | FROM --platform=linux/${NANOARROW_ARCH} alpine:latest 21 | 22 | RUN apk add bash linux-headers git cmake R R-dev g++ gfortran gnupg curl py3-virtualenv python3-dev 23 | 24 | # For Arrow C++ 25 | COPY ci/scripts/build-arrow-cpp-minimal.sh / 26 | RUN /build-arrow-cpp-minimal.sh 18.1.0 /arrow 27 | 28 | # There's a missing define that numpy's build needs on s390x and there is no wheel 29 | RUN (grep -e "S390" /usr/include/bits/hwcap.h && echo "#define HWCAP_S390_VX HWCAP_S390_VXRS" >> /usr/include/bits/hwcap.h) || true 30 | RUN virtualenv -v --download /venv 31 | RUN source /venv/bin/activate && pip install build Cython pytest pytest-cython numpy 32 | ENV NANOARROW_PYTHON_VENV "/venv" 33 | 34 | # For R. Note that arrow is not installed (takes too long). 35 | RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars 36 | COPY r/DESCRIPTION /tmp/rdeps 37 | RUN R -e 'gsub("\\(.*?\\)", "", read.dcf("/tmp/rdeps")[1, "Suggests"]) |> strsplit("[^A-Za-z0-9.]+") |> unlist(use.names = FALSE) |> setdiff("arrow") |> install.packages(repos = "https://cloud.r-project.org")' 38 | RUN rm -f ~/.R/Makevars 39 | 40 | ENV NANOARROW_CMAKE_OPTIONS -DArrow_DIR=/arrow/lib/cmake/Arrow 41 | -------------------------------------------------------------------------------- /ci/docker/archlinux.dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | FROM archlinux:latest 19 | 20 | RUN pacman -Syu --noconfirm git gcc gcc-fortran make cmake gnupg curl which \ 21 | python-pip python-build cython python-numpy python-pytest python-virtualenv \ 22 | r \ 23 | arrow python-pyarrow 24 | 25 | # For Python 26 | RUN virtualenv -v --download --system-site-packages /venv 27 | RUN source /venv/bin/activate && pip install pytest-cython 28 | ENV NANOARROW_PYTHON_VENV "/venv" 29 | 30 | # For R 31 | RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars 32 | RUN R -e 'install.packages("desc", repos = "https://cloud.r-project.org")' && mkdir /tmp/rdeps 33 | COPY r/DESCRIPTION /tmp/rdeps 34 | RUN R -e 'install.packages(setdiff(desc::desc("/tmp/rdeps")$get_deps()$package, "arrow"), repos = "https://cloud.r-project.org")' 35 | RUN rm -f ~/.R/Makevars 36 | -------------------------------------------------------------------------------- /ci/docker/fedora.dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | ARG NANOARROW_ARCH 19 | 20 | FROM --platform=linux/${NANOARROW_ARCH} fedora:latest 21 | 22 | RUN dnf install -y git cmake R gnupg curl libarrow-devel glibc-langpack-en \ 23 | python3-devel python3-virtualenv awk 24 | 25 | # For Python 26 | RUN python3 -m venv --upgrade-deps /venv 27 | RUN source /venv/bin/activate && pip install build Cython pytest pytest-cython numpy pyarrow 28 | ENV NANOARROW_PYTHON_VENV "/venv" 29 | 30 | # For R. Note that arrow is not installed (takes too long). 31 | RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars 32 | RUN R -e 'install.packages("desc", repos = "https://cloud.r-project.org")' && mkdir /tmp/rdeps 33 | COPY r/DESCRIPTION /tmp/rdeps 34 | RUN R -e 'install.packages(setdiff(desc::desc("/tmp/rdeps")$get_deps()$package, "arrow"), repos = "https://cloud.r-project.org")' 35 | RUN rm -f ~/.R/Makevars 36 | -------------------------------------------------------------------------------- /ci/scripts/run-clang-tidy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set -e 21 | 22 | main() { 23 | local -r source_dir="${1}" 24 | local -r build_dir="${2}" 25 | 26 | if [ $(uname) = "Darwin" ]; then 27 | local -r jobs=$(sysctl -n hw.ncpu) 28 | else 29 | local -r jobs=$(nproc) 30 | fi 31 | 32 | set -x 33 | 34 | run-clang-tidy -p "${build_dir}" -j$jobs \ 35 | -extra-arg=-Wno-unknown-warning-option | \ 36 | tee "${build_dir}/clang-tidy-output.txt" 37 | 38 | if grep -e "warning:" -e "error:" "${build_dir}/clang-tidy-output.txt"; then 39 | echo "Warnings or errors found!" 40 | exit 1 41 | else 42 | echo "No warnings or errors found!" 43 | fi 44 | 45 | set +x 46 | } 47 | 48 | main "$@" 49 | -------------------------------------------------------------------------------- /ci/scripts/test-python-wheels.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set -e 21 | set -o pipefail 22 | 23 | if [ ${VERBOSE:-0} -gt 0 ]; then 24 | set -x 25 | fi 26 | 27 | SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" 28 | NANOARROW_DIR="$(cd "${SOURCE_DIR}/../.." && pwd)" 29 | 30 | case $# in 31 | 0) export CIBW_BUILD="" 32 | ;; 33 | 1) export CIBW_BUILD="$1" 34 | ;; 35 | *) echo "Usage:" 36 | echo " Build and test wheels locally using cibuildwheel" 37 | echo " (requires pip install cibuildwheel)" 38 | echo " $0 ...builds all wheels" 39 | echo " $0 'pp*' ...builds and tests just pypy wheels" 40 | exit 1 41 | ;; 42 | esac 43 | 44 | # Respect existing CIBW_TEST_REQUIRES (could be used to test all wheels 45 | # with numpy and pyarrow installed, for example) 46 | export CIBW_TEST_REQUIRES="pytest $CIBW_TEST_REQUIRES" 47 | export CIBW_TEST_COMMAND="pytest {package}/tests -vv" 48 | 49 | pushd "${NANOARROW_DIR}" 50 | python -m cibuildwheel --output-dir python/dist python 51 | popd 52 | -------------------------------------------------------------------------------- /cmake/config.cmake.in: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | 19 | @PACKAGE_INIT@ 20 | 21 | cmake_minimum_required(VERSION @CMAKE_MINIMUM_REQUIRED_VERSION@) 22 | 23 | include("${CMAKE_CURRENT_LIST_DIR}/nanoarrow-targets.cmake" REQUIRED) 24 | include("${CMAKE_CURRENT_LIST_DIR}/nanoarrow-config-version.cmake" REQUIRED) 25 | 26 | foreach(target nanoarrow nanoarrow_ipc nanoarrow_device nanoarrow_testing) 27 | if(TARGET nanoarrow::${target}_static) 28 | if(BUILD_SHARED_LIBS) 29 | add_library(nanoarrow::${target} ALIAS nanoarrow::${target}_shared) 30 | else() 31 | add_library(nanoarrow::${target} ALIAS nanoarrow::${target}_static) 32 | endif() 33 | endif() 34 | endforeach() 35 | 36 | set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}") 37 | include(FindPackageHandleStandardArgs) 38 | find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE) 39 | -------------------------------------------------------------------------------- /dev/benchmarks/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | .Rhistory 19 | benchmark-report.md 20 | fixtures/ 21 | asv_results 22 | asv_env 23 | asv_html 24 | -------------------------------------------------------------------------------- /dev/benchmarks/apidoc/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | xml 19 | -------------------------------------------------------------------------------- /dev/benchmarks/benchmarks.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | -------------------------------------------------------------------------------- /dev/benchmarks/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | srcdir = include_directories('../..') # needed to resolve nanoarrow_config.h 19 | 20 | gbench = dependency('benchmark') 21 | schema_e = executable( 22 | 'schema_benchmark', 23 | 'c/schema_benchmark.cc', 24 | include_directories: [srcdir], 25 | dependencies: [gbench, nanoarrow_dep], 26 | ) 27 | benchmark('schema benchmark', schema_e) 28 | 29 | array_e = executable( 30 | 'array_benchmark', 31 | 'c/array_benchmark.cc', 32 | include_directories: [srcdir], 33 | dependencies: [gbench, nanoarrow_dep], 34 | ) 35 | benchmark('array benchmark', array_e) 36 | -------------------------------------------------------------------------------- /dev/benchmarks/python/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /dev/benchmarks/python/schema.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import nanoarrow as na 19 | 20 | 21 | class SchemaSuite: 22 | """ 23 | Benchmarks of some Schema/CSchema operations 24 | """ 25 | 26 | def setup(self): 27 | self.children = [na.int32()] * 10000 28 | self.c_children = [na.c_schema(child) for child in self.children] 29 | self.c_wide_struct = na.c_schema(na.struct(self.children)) 30 | 31 | def time_create_wide_struct_from_schemas(self): 32 | """Create a struct Schema with 10000 columns from a list of Schema""" 33 | na.struct(self.children) 34 | 35 | def time_create_wide_struct_from_c_schemas(self): 36 | """Create a struct Schema with 10000 columns from a list of CSchema""" 37 | na.struct(self.c_children) 38 | 39 | def time_c_schema_protocol_wide_struct(self): 40 | """Export a struct Schema with 10000 columns via the PyCapsule protocol""" 41 | self.c_wide_struct.__arrow_c_schema__() 42 | -------------------------------------------------------------------------------- /dev/release/.env.example: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | GPG_KEY_ID=XXXXX 21 | APACHE_USERNAME=XXXXX 22 | -------------------------------------------------------------------------------- /dev/release/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | .env 19 | __pycache__ 20 | -------------------------------------------------------------------------------- /dev/release/rat_exclude_files.txt: -------------------------------------------------------------------------------- 1 | *.json 2 | *.json.example 3 | dev/release/rat_exclude_files.txt 4 | filtered_rat.txt 5 | rat.txt 6 | r/DESCRIPTION 7 | r/NAMESPACE 8 | r/.Rbuildignore 9 | *.Rproj 10 | *.Rd 11 | r/tests/testthat/_snaps/*.md 12 | r/cran-comments.md 13 | dist/flatcc/* 14 | dist/flatcc.c 15 | src/nanoarrow/ipc/flatcc_generated.h 16 | thirdparty/* 17 | python/src/nanoarrow/dlpack_abi.h 18 | python/subprojects/arrow-nanoarrow 19 | -------------------------------------------------------------------------------- /dev/release/run-rat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | RAT_VERSION=0.13 22 | 23 | # download apache rat 24 | if [ ! -f apache-rat-${RAT_VERSION}.jar ]; then 25 | curl -s https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar > apache-rat-${RAT_VERSION}.jar 26 | fi 27 | 28 | RAT="java -jar apache-rat-${RAT_VERSION}.jar -x " 29 | 30 | RELEASE_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd) 31 | 32 | # generate the rat report 33 | $RAT $1 > rat.txt 34 | python $RELEASE_DIR/check-rat-report.py $RELEASE_DIR/rat_exclude_files.txt rat.txt > filtered_rat.txt 35 | cat filtered_rat.txt 36 | UNAPPROVED=`cat filtered_rat.txt | grep "NOT APPROVED" | wc -l` 37 | 38 | if [ "0" -eq "${UNAPPROVED}" ]; then 39 | echo "No unapproved licenses" 40 | else 41 | echo "${UNAPPROVED} unapproved licences. Check rat report: rat.txt" 42 | exit 1 43 | fi 44 | -------------------------------------------------------------------------------- /dev/release/source_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set -eu 21 | 22 | main() { 23 | local -r source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 24 | local -r source_top_dir="$(cd "${source_dir}/../../" && pwd)" 25 | 26 | if [ "$#" -ne 2 ]; then 27 | echo "Usage: $0 " 28 | echo "Usage: $0 apache-arrow-nanoarrow-1.0.0 1234567" 29 | exit 1 30 | fi 31 | local -r base_name="$1" 32 | local -r revision="$2" 33 | 34 | echo "Using commit ${revision}" 35 | 36 | local -r tar_ball="${base_name}.tar.gz" 37 | 38 | pushd "${source_top_dir}" 39 | 40 | rm -rf "${base_name}/" 41 | git archive "${revision}" --prefix "${base_name}/" | tar xf - 42 | 43 | # Resolve all hard and symbolic links 44 | rm -rf "${base_name}.tmp/" 45 | mv "${base_name}/" "${base_name}.tmp/" 46 | cp -R -d "${base_name}.tmp" "${base_name}" 47 | rm -rf "${base_name}.tmp/" 48 | 49 | # Create new tarball 50 | tar czf "${tar_ball}" "${base_name}/" 51 | rm -rf "${base_name}/" 52 | 53 | # check licenses 54 | "${source_top_dir}/dev/release/run-rat.sh" "${tar_ball}" 55 | 56 | echo "Commit SHA1: ${revision}" 57 | 58 | popd 59 | } 60 | 61 | main "$@" 62 | -------------------------------------------------------------------------------- /dev/update_fbs.sh: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # get the .fbs files from the arrow repo 19 | mkdir -p format && cd format 20 | 21 | curl -L https://github.com/apache/arrow/raw/main/format/Schema.fbs --output Schema.fbs 22 | curl -L https://github.com/apache/arrow/raw/main/format/Tensor.fbs --output Tensor.fbs 23 | curl -L https://github.com/apache/arrow/raw/main/format/SparseTensor.fbs --output SparseTensor.fbs 24 | curl -L https://github.com/apache/arrow/raw/main/format/Message.fbs --output Message.fbs 25 | curl -L https://github.com/apache/arrow/raw/main/format/File.fbs --output File.fbs 26 | 27 | # compile using flatcc 28 | flatcc --common --reader --builder --verifier --recursive --outfile ../../src/nanoarrow/ipc/flatcc_generated.h *.fbs 29 | 30 | # clean up 31 | cd .. 32 | rm -rf format 33 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | _build/ 19 | *_generated.rst 20 | source/roadmap.rst 21 | source/getting-started/cpp.rst 22 | source/getting-started/r.rst 23 | source/getting-started/python.rst 24 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # Building nanoarrow documentation 21 | 22 | Building the nanoarrow documentation requires [Python](https://python.org), [R](https://r-project.org), [Doxygen](https://doxygen.nl), and [pandoc](https://pandoc.org/). In addition, several Python and R packages are required. You can install the Python dependencies using `pip install -r requirements.txt` in this directory; you can install the R dependencies using `R -e 'install.packages("pkgdown")`. 23 | 24 | The `ci/scripts/build-docs.sh` script (or the `docker compose run --rm docs` compose service) can be used to run all steps at once, after which `sphinx-build source _build/html` can be used to iterate on changes. 25 | 26 | ```bash 27 | git clone https://github.com/apache/arrow-nanoarrow.git 28 | 29 | # Usually easiest to start with one of the docs build scripts 30 | docker compose run --rm docs 31 | # or install prerequisites and run 32 | ci/scripts/build-docs.sh 33 | 34 | # Iterate on Sphinx documentation 35 | cd docs 36 | sphinx-build source _build/html 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | pydata-sphinx-theme 19 | sphinx<7.2.0 20 | breathe 21 | -------------------------------------------------------------------------------- /docs/source/getting-started/index.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Getting Started 19 | =============== 20 | 21 | .. toctree:: 22 | :maxdepth: 2 23 | 24 | C/C++ 25 | Python 26 | R 27 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | .. include:: README_generated.rst 19 | 20 | Contents 21 | -------- 22 | 23 | .. toctree:: 24 | :maxdepth: 2 25 | 26 | Getting Started 27 | Roadmap 28 | API Reference 29 | -------------------------------------------------------------------------------- /docs/source/reference/cpp.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | C++ API Reference 19 | ================== 20 | 21 | .. doxygengroup:: nanoarrow_hpp 22 | 23 | Error handling 24 | -------------- 25 | 26 | .. doxygengroup:: nanoarrow_hpp-errors 27 | :members: 28 | 29 | Owning object wrappers 30 | ---------------------- 31 | .. doxygengroup:: nanoarrow_hpp-unique 32 | :members: 33 | 34 | Array Stream utilities 35 | ---------------------- 36 | 37 | .. doxygengroup:: nanoarrow_hpp-array-stream 38 | :members: 39 | 40 | Buffer utilities 41 | ---------------- 42 | 43 | .. doxygengroup:: nanoarrow_hpp-buffer 44 | :members: 45 | 46 | Range-for utilities 47 | ------------------- 48 | 49 | .. doxygengroup:: nanoarrow_hpp-range_for 50 | :members: 51 | -------------------------------------------------------------------------------- /docs/source/reference/device.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Device Extension Reference 19 | ========================== 20 | 21 | C API 22 | ------------------------ 23 | 24 | .. doxygengroup:: nanoarrow_device 25 | :project: nanoarrow_c 26 | :members: 27 | 28 | C++ Helpers 29 | ------------------------ 30 | 31 | .. doxygengroup:: nanoarrow_device_hpp-unique 32 | :project: nanoarrow_c 33 | :members: 34 | 35 | Arrow C Device Interface 36 | ------------------------ 37 | 38 | .. doxygengroup:: nanoarrow_device-arrow-cdata 39 | :project: nanoarrow_c 40 | :members: 41 | :undoc-members: 42 | -------------------------------------------------------------------------------- /docs/source/reference/index.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | API Reference 19 | ============= 20 | 21 | .. toctree:: 22 | :maxdepth: 2 23 | 24 | R API Reference 25 | Python API Reference 26 | C API Reference 27 | C++ API Reference 28 | Testing API Reference 29 | IPC Extension Reference 30 | Device Extension Reference 31 | -------------------------------------------------------------------------------- /docs/source/reference/ipc.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | IPC Extension Reference 19 | ======================= 20 | 21 | C API 22 | ------------------------ 23 | 24 | .. doxygengroup:: nanoarrow_ipc 25 | :project: nanoarrow_c 26 | :members: 27 | 28 | C++ Helpers 29 | ------------------------ 30 | 31 | .. doxygengroup:: nanoarrow_ipc_hpp-unique 32 | :project: nanoarrow_c 33 | :members: 34 | -------------------------------------------------------------------------------- /docs/source/reference/python/advanced.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Low-level Helpers 19 | ================= 20 | 21 | C Schema Utilities 22 | ------------------ 23 | 24 | .. automodule:: nanoarrow.c_schema 25 | :members: 26 | 27 | C Array Utilities 28 | ----------------- 29 | 30 | .. automodule:: nanoarrow.c_array 31 | :members: 32 | 33 | C ArrayStream Utilities 34 | ----------------------- 35 | 36 | .. automodule:: nanoarrow.c_array_stream 37 | :members: 38 | -------------------------------------------------------------------------------- /docs/source/reference/python/array-stream.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | High-level ArrayStream Implementation 19 | ===================================== 20 | 21 | .. automodule:: nanoarrow.array_stream 22 | :members: 23 | -------------------------------------------------------------------------------- /docs/source/reference/python/array.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | High-level ArrayStream Implementation 19 | ===================================== 20 | 21 | .. automodule:: nanoarrow.array 22 | :members: 23 | -------------------------------------------------------------------------------- /docs/source/reference/python/index.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Python API reference 19 | ==================== 20 | 21 | .. automodule:: nanoarrow 22 | 23 | .. toctree:: 24 | :maxdepth: 2 25 | 26 | Schema/DataType Objects 27 | High-level Array Implementation 28 | High-level ArrayStream Implementation 29 | Low-level Helpers 30 | -------------------------------------------------------------------------------- /docs/source/reference/python/schema.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Schema/Data Type Objects 19 | ======================== 20 | 21 | .. automodule:: nanoarrow.schema 22 | :members: 23 | -------------------------------------------------------------------------------- /docs/source/reference/r.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | R API Reference 19 | ================== 20 | 21 | See `R Documentation <../r/reference/index.html>`__. 22 | -------------------------------------------------------------------------------- /docs/source/reference/testing.rst: -------------------------------------------------------------------------------- 1 | .. Licensed to the Apache Software Foundation (ASF) under one 2 | .. or more contributor license agreements. See the NOTICE file 3 | .. distributed with this work for additional information 4 | .. regarding copyright ownership. The ASF licenses this file 5 | .. to you under the Apache License, Version 2.0 (the 6 | .. "License"); you may not use this file except in compliance 7 | .. with the License. You may obtain a copy of the License at 8 | 9 | .. http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | .. Unless required by applicable law or agreed to in writing, 12 | .. software distributed under the License is distributed on an 13 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | .. KIND, either express or implied. See the License for the 15 | .. specific language governing permissions and limitations 16 | .. under the License. 17 | 18 | Testing API Reference 19 | ====================== 20 | 21 | .. doxygengroup:: nanoarrow_testing 22 | 23 | Integration testing JSON 24 | ------------------------ 25 | 26 | .. doxygengroup:: nanoarrow_testing-json 27 | :members: 28 | -------------------------------------------------------------------------------- /examples/cmake-ipc/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # IPC Extension CMake Example 21 | 22 | This folder contains a CMake project that links to its own copy of 23 | nanoarrow and nanoarrow_ipc using CMake's `FetchContent` module. 24 | This pattern is similar to the cmake-minimal example and includes 25 | both a library and a command-line application that can verify 26 | a small message read from stdin. To build: 27 | 28 | ```bash 29 | git clone https://github.com/apache/arrow-nanoarrow.git 30 | cd arrow-nanoarrow/examples/cmake-ipc 31 | mkdir build && cd build 32 | cmake .. 33 | cmake --build . 34 | ``` 35 | 36 | You can test the command-line application using the two files 37 | provided in the example directory: 38 | 39 | ```bash 40 | cat ../schema-valid.arrows | ./example_cmake_ipc_app 41 | cat ../invalid.arrows | ./example_cmake_ipc_app 42 | # Expected 0xFFFFFFFF at start of message but found 0xFFFFFF00 43 | ``` 44 | -------------------------------------------------------------------------------- /examples/cmake-ipc/invalid.arrows: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/arrow-nanoarrow/78a0d217eaf4ed32d8bbd10d665eec67b9b3b0ee/examples/cmake-ipc/invalid.arrows -------------------------------------------------------------------------------- /examples/cmake-ipc/schema-valid.arrows: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/arrow-nanoarrow/78a0d217eaf4ed32d8bbd10d665eec67b9b3b0ee/examples/cmake-ipc/schema-valid.arrows -------------------------------------------------------------------------------- /examples/cmake-ipc/src/app.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include "library.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | int main(int argc, char* argv[]) { 25 | int64_t in_size = 0; 26 | uint8_t data[8096]; 27 | 28 | freopen(NULL, "rb", stdin); 29 | in_size = fread(data, 1, 8096, stdin); 30 | 31 | if (in_size == 8096) { 32 | fprintf(stderr, "This example can't read messages more than 8096 bytes\n"); 33 | return -1; 34 | } 35 | 36 | int result = verify_ipc_message(data, in_size); 37 | if (result != 0) { 38 | fprintf(stderr, "%s\n", my_library_last_error()); 39 | } 40 | 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /examples/cmake-ipc/src/library.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include "nanoarrow/nanoarrow_ipc.h" 24 | 25 | #include "library.h" 26 | 27 | static struct ArrowError global_error; 28 | 29 | const char* my_library_last_error(void) { return ArrowErrorMessage(&global_error); } 30 | 31 | int verify_ipc_message(const void* data, int64_t size_bytes) { 32 | struct ArrowBufferView buffer_view; 33 | buffer_view.data.data = data; 34 | buffer_view.size_bytes = size_bytes; 35 | 36 | struct ArrowIpcDecoder decoder; 37 | ArrowIpcDecoderInit(&decoder); 38 | int result = ArrowIpcDecoderVerifyHeader(&decoder, buffer_view, &global_error); 39 | ArrowIpcDecoderReset(&decoder); 40 | 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /examples/cmake-ipc/src/library.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | // Get the last error message from a call to verify_ipc_message() 23 | const char* my_library_last_error(void); 24 | 25 | // Verifies an IPC message 26 | int verify_ipc_message(const void* data, int64_t size_bytes); 27 | -------------------------------------------------------------------------------- /examples/cmake-minimal/src/app.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include "library.h" 19 | 20 | #include 21 | 22 | int main(int argc, char* argv[]) { 23 | struct ArrowArray array; 24 | struct ArrowSchema schema; 25 | array.release = NULL; 26 | schema.release = NULL; 27 | 28 | int result = make_simple_array(&array, &schema); 29 | if (result != 0) { 30 | if (array.release) array.release(&array); 31 | if (schema.release) schema.release(&schema); 32 | return result; 33 | } 34 | 35 | result = print_simple_array(&array, &schema); 36 | if (array.release) array.release(&array); 37 | if (schema.release) schema.release(&schema); 38 | 39 | return result; 40 | } 41 | -------------------------------------------------------------------------------- /examples/cmake-scenarios/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # CMake Comprehensive Examples 21 | 22 | This folder contains a CMake project that showcases the many different 23 | ways in which nanoarrow may be used by other projects. The project 24 | exposes a few options for configuring how nanoarrow is found and 25 | built. It shows how nanoarrow may be fetched from source during the 26 | build via FetchContent as well as how it may be preinstalled on the 27 | system and then found by the consumer. 28 | 29 | To demonstrate the various scenarios, this project comes with a build 30 | script that iterates through the different possibilities. To test this 31 | out, simply run 32 | 33 | ```bash 34 | ./build.sh 35 | ``` 36 | -------------------------------------------------------------------------------- /examples/cmake-scenarios/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set -exuo pipefail 21 | 22 | # For Windows, the PATH needs to be set for it to be able to find the right DLLs 23 | WIN_DLL_NANOARROW_FETCHED="$(pwd)/scratch/build_against_fetched_shared/_deps/nanoarrow-build/Debug" 24 | WIN_DLL_NANOARROW_BUILT="$(pwd)/scratch/nanoarrow_build/Debug" 25 | WIN_DLL_NANOARROW_INSTALLED="$(pwd)/scratch/nanoarrow_install/bin" 26 | 27 | for dir in scratch/build*; do 28 | # Special cases where we have to set PATH on Windows 29 | if [ "${dir}" = "scratch/build_against_fetched_shared" ] && [ "${OSTYPE}" = "msys" ]; then 30 | PATH="${PATH}:${WIN_DLL_NANOARROW_FETCHED}" ./${dir}/Debug/minimal_cpp_app 31 | elif [ "${dir}" = "scratch/build_shared" ] && [ "${OSTYPE}" = "msys" ]; then 32 | PATH="${PATH}:${WIN_DLL_NANOARROW_BUILT}" ./${dir}/Debug/minimal_cpp_app 33 | elif [ "${dir}" = "scratch/build_against_install_shared" ] && [ "${OSTYPE}" = "msys" ]; then 34 | PATH="${PATH}:${WIN_DLL_NANOARROW_INSTALLED}" ./${dir}/Debug/minimal_cpp_app 35 | elif [ "${OSTYPE}" = "msys" ]; then 36 | ./${dir}/Debug/minimal_cpp_app 37 | else 38 | ./${dir}/minimal_cpp_app 39 | fi 40 | done 41 | 42 | echo "Success!" 43 | -------------------------------------------------------------------------------- /examples/linesplitter/linesplitter_test.cc: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | 20 | #include 21 | 22 | #include "linesplitter.h" 23 | 24 | TEST(Linesplitter, LinesplitterRoundtrip) { 25 | nanoarrow::UniqueArray out; 26 | auto result = linesplitter_read("line1\nline2\nline3", out.get()); 27 | ASSERT_EQ(result.first, 0); 28 | ASSERT_EQ(result.second, ""); 29 | 30 | ASSERT_EQ(out->length, 3); 31 | 32 | nanoarrow::UniqueArrayView out_view; 33 | ArrowArrayViewInitFromType(out_view.get(), NANOARROW_TYPE_STRING); 34 | ASSERT_EQ(ArrowArrayViewSetArray(out_view.get(), out.get(), nullptr), 0); 35 | ArrowStringView item; 36 | 37 | item = ArrowArrayViewGetStringUnsafe(out_view.get(), 0); 38 | ASSERT_EQ(std::string(item.data, item.size_bytes), "line1"); 39 | 40 | item = ArrowArrayViewGetStringUnsafe(out_view.get(), 1); 41 | ASSERT_EQ(std::string(item.data, item.size_bytes), "line2"); 42 | 43 | item = ArrowArrayViewGetStringUnsafe(out_view.get(), 2); 44 | ASSERT_EQ(std::string(item.data, item.size_bytes), "line3"); 45 | 46 | auto result2 = linesplitter_write(out.get()); 47 | ASSERT_EQ(result2.first, 0); 48 | ASSERT_EQ(result2.second, "line1\nline2\nline3\n"); 49 | } 50 | -------------------------------------------------------------------------------- /examples/meson-minimal/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # Minimal Meson Example 21 | 22 | This folder contains a meson project that links to its own copy of 23 | nanoarrow using a subproject. Because nanoarrow is available from 24 | [WrapDB](), one can install it as a meson dependency with: 25 | 26 | ```shell 27 | mkdir subprojects 28 | meson wrap install nanoarrow 29 | ``` 30 | 31 | For testing purposes, this project has an existing wrap file that 32 | points to the current commit; however, most project should use 33 | the wrap file generated by `meson wrap install nanoarrow`. 34 | 35 | To build this project: 36 | 37 | ```bash 38 | git clone https://github.com/apache/arrow-nanoarrow.git 39 | cd arrow-nanoarrow/examples/meson-minimal 40 | meson setup builddir && cd builddir 41 | meson compile 42 | ``` 43 | 44 | After building, you can run the app from the build directory. The app 45 | parses command line arguments into an int32 array and prints out the 46 | resulting length (or any error encountered whilst building the array). 47 | 48 | ```bash 49 | ./example_meson_minimal_app 50 | # 1 51 | # 2 52 | # 3 53 | ``` 54 | -------------------------------------------------------------------------------- /examples/meson-minimal/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project( 19 | 'nanoarrow-example-meson-minimal', 20 | 'cpp', 21 | license: 'Apache 2.0', 22 | meson_version: '>=1.3.0', 23 | default_options: ['buildtype=release', 'warning_level=2', 'cpp_std=c++17'], 24 | ) 25 | 26 | nanoarrow_dep = dependency('nanoarrow') 27 | example_exec = executable( 28 | 'example_meson_minimal_app', 29 | 'src/app.cc', 30 | dependencies: [nanoarrow_dep], 31 | ) 32 | -------------------------------------------------------------------------------- /examples/meson-minimal/src/app.cc: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include "nanoarrow/nanoarrow.h" 19 | #include "nanoarrow/nanoarrow.hpp" 20 | 21 | int main(void) { 22 | nanoarrow::UniqueSchema schema; 23 | NANOARROW_RETURN_NOT_OK(ArrowSchemaInitFromType(schema.get(), NANOARROW_TYPE_INT32)); 24 | printf("Schema format for int32 is '%s'\n", schema->format); 25 | return EXIT_SUCCESS; 26 | } 27 | -------------------------------------------------------------------------------- /examples/meson-minimal/subprojects/nanoarrow.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-git] 19 | # url should point to the project root with the top-level meson.build file 20 | url = ../../.. 21 | revision = head 22 | 23 | [provide] 24 | nanoarrow = nanoarrow_dep 25 | -------------------------------------------------------------------------------- /examples/python-package/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | subprojects/* 19 | !subprojects/packagefiles 20 | !subprojects/*.wrap 21 | 22 | builddir 23 | -------------------------------------------------------------------------------- /examples/python-package/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project( 19 | 'nanoarrow-python-demo', 20 | 'c', 21 | version: '0.0.1dev', 22 | default_options: ['warning_level=2', 'c_std=c17', 'default_library=static'], 23 | ) 24 | 25 | py = import('python').find_installation() 26 | nanoarrow_dep = dependency('nanoarrow') 27 | 28 | py.extension_module( 29 | 'schema_printer', 30 | sources: ['src/nanoarrow_python_demo/schema_printer.c'], 31 | dependencies: [nanoarrow_dep], 32 | install: true, 33 | ) 34 | -------------------------------------------------------------------------------- /examples/python-package/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [project] 19 | name = 'nanoarrow-python-demo' 20 | dynamic = ['version'] # gets version from build backend 21 | description = "Sample Python package using nanoarrow" 22 | 23 | [build-system] 24 | requires = ['meson-python', 'meson'] 25 | build-backend= 'mesonpy' 26 | 27 | [tool.meson-python.args] 28 | # We are going to statically link any subprojects in our Meson configuration 29 | # so no need to try and install them. You may need to customize this if you 30 | # do have shared libraries that you want to install into your Python wheel 31 | install = ['--skip-subprojects'] 32 | -------------------------------------------------------------------------------- /examples/python-package/subprojects/nanoarrow.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = arrow-nanoarrow-apache-arrow-nanoarrow-0.5.0 20 | source_url = https://github.com/apache/arrow-nanoarrow/archive/refs/tags/apache-arrow-nanoarrow-0.5.0.tar.gz 21 | source_filename = apache-arrow-nanoarrow-0.5.0.tar.gz 22 | source_hash = 0ceeaa1fb005dbc89c8c7d1b39f2dba07344e40aa9d885ee25fb55b4d57e331a 23 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nanoarrow_0.5.0-1/apache-arrow-nanoarrow-0.5.0.tar.gz 24 | wrapdb_version = 0.5.0-1 25 | 26 | [provide] 27 | nanoarrow = nanoarrow_dep 28 | -------------------------------------------------------------------------------- /examples/vendored-ipc/invalid.arrows: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/arrow-nanoarrow/78a0d217eaf4ed32d8bbd10d665eec67b9b3b0ee/examples/vendored-ipc/invalid.arrows -------------------------------------------------------------------------------- /examples/vendored-ipc/schema-valid.arrows: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/arrow-nanoarrow/78a0d217eaf4ed32d8bbd10d665eec67b9b3b0ee/examples/vendored-ipc/schema-valid.arrows -------------------------------------------------------------------------------- /examples/vendored-ipc/src/app.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include "library.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | int main(int argc, char* argv[]) { 25 | int64_t in_size = 0; 26 | uint8_t data[8096]; 27 | 28 | freopen(NULL, "rb", stdin); 29 | in_size = fread(data, 1, 8096, stdin); 30 | 31 | if (in_size == 8096) { 32 | fprintf(stderr, "This example can't read messages more than 8096 bytes\n"); 33 | return -1; 34 | } 35 | 36 | int result = verify_ipc_message(data, in_size); 37 | if (result != 0) { 38 | fprintf(stderr, "%s\n", my_library_last_error()); 39 | } 40 | 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /examples/vendored-ipc/src/library.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include "nanoarrow/nanoarrow_ipc.h" 24 | 25 | #include "library.h" 26 | 27 | static struct ArrowError global_error; 28 | 29 | const char* my_library_last_error(void) { return ArrowErrorMessage(&global_error); } 30 | 31 | int verify_ipc_message(const void* data, int64_t size_bytes) { 32 | struct ArrowBufferView buffer_view; 33 | buffer_view.data.data = data; 34 | buffer_view.size_bytes = size_bytes; 35 | 36 | struct ArrowIpcDecoder decoder; 37 | ArrowIpcDecoderInit(&decoder); 38 | int result = ArrowIpcDecoderVerifyHeader(&decoder, buffer_view, &global_error); 39 | ArrowIpcDecoderReset(&decoder); 40 | 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /examples/vendored-ipc/src/library.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | // Get the last error message from a call to verify_ipc_message() 23 | const char* my_library_last_error(void); 24 | 25 | // Verifies an IPC message 26 | int verify_ipc_message(const void* data, int64_t size_bytes); 27 | -------------------------------------------------------------------------------- /examples/vendored-ipc/src/nanoarrow/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # Vendored Subdirectory example 21 | 22 | Place vendored nanoarrow files here. 23 | -------------------------------------------------------------------------------- /examples/vendored-minimal/src/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | *.o 19 | *.a 20 | example_vendored_minimal_app 21 | -------------------------------------------------------------------------------- /examples/vendored-minimal/src/app.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include "library.h" 19 | 20 | #include 21 | 22 | int main(int argc, char* argv[]) { 23 | struct ArrowArray array; 24 | struct ArrowSchema schema; 25 | array.release = NULL; 26 | schema.release = NULL; 27 | 28 | int result = make_simple_array(&array, &schema); 29 | if (result != 0) { 30 | if (array.release) array.release(&array); 31 | if (schema.release) schema.release(&schema); 32 | return result; 33 | } 34 | 35 | result = print_simple_array(&array, &schema); 36 | if (array.release) array.release(&array); 37 | if (schema.release) schema.release(&schema); 38 | 39 | return result; 40 | } 41 | -------------------------------------------------------------------------------- /examples/vendored-minimal/src/nanoarrow.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | // See the README in this directory for how to generate this file 19 | -------------------------------------------------------------------------------- /examples/vendored-minimal/src/nanoarrow/nanoarrow.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | // See the README in this directory for how to generate this file 19 | -------------------------------------------------------------------------------- /meson.options: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | option('tests', type: 'feature', description: 'Build tests') 19 | option('tests_with_arrow', type: 'feature', description: 'Build tests with Arrow') 20 | option('benchmarks', type: 'feature', description: 'Build benchmarks') 21 | option('apps', type: 'feature', description: 'Build utility applications') 22 | option('ipc', type: 'feature', description: 'Build IPC libraries') 23 | option('ipc_with_zstd', type: 'feature', description: 'Build IPC libraries with ZSTD compression support') 24 | option( 25 | 'integration_tests', type: 'feature', 26 | description: 'Build cross-implementation Arrow integration tests', 27 | ) 28 | option('namespace', type: 'string', 29 | description: 'A prefix for exported symbols') 30 | option('device', type: 'feature', description: 'Build device libraries') 31 | option('testing', type: 'feature', description: 'Build testing libraries') 32 | option('metal', type: 'feature', description: 'Build Apple metal libraries') 33 | option('cuda', type: 'feature', description: 'Build CUDA libraries') 34 | -------------------------------------------------------------------------------- /python/.coveragerc: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # .coveragerc to control coverage.py 19 | [run] 20 | plugins = Cython.Coverage 21 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | src/nanoarrow/_*.c 20 | .mesonpy-* 21 | 22 | # Byte-compiled / optimized / DLL files 23 | __pycache__/ 24 | *.py[cod] 25 | *$py.class 26 | 27 | # C extensions 28 | *.so 29 | 30 | # Distribution / packaging 31 | .Python 32 | build/ 33 | develop-eggs/ 34 | dist/ 35 | downloads/ 36 | eggs/ 37 | .eggs/ 38 | lib/ 39 | lib64/ 40 | parts/ 41 | sdist/ 42 | var/ 43 | wheels/ 44 | pip-wheel-metadata/ 45 | share/python-wheels/ 46 | *.egg-info/ 47 | .installed.cfg 48 | *.egg 49 | MANIFEST 50 | 51 | # Unit test / coverage reports 52 | .pytest_cache/ 53 | -------------------------------------------------------------------------------- /python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | recursive-include vendor *.c *.h *.pxd 19 | recursive-include src/nanoarrow *.pxd 20 | recursive-include src/nanoarrow *.h 21 | 22 | exclude bootstrap.py 23 | exclude src/nanoarrow/*.c 24 | recursive-exclude src/nanoarrow *.o *.so 25 | -------------------------------------------------------------------------------- /python/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project( 19 | 'nanoarrow', 20 | 'c', 21 | 'cython', 22 | version: run_command(['src/nanoarrow/_version.py', '--print'], check: true).stdout().strip(), 23 | license: 'Apache-2.0', 24 | meson_version: '>=1.2.0', 25 | default_options: [ 26 | 'warning_level=2', 27 | 'c_std=c99', 28 | 'default_library=static', 29 | 'force_fallback_for=zstd', 30 | # We need to set these options at the project default_option level 31 | # due to https://github.com/mesonbuild/meson/issues/6728 32 | 'arrow-nanoarrow:ipc=enabled', 33 | 'arrow-nanoarrow:ipc_with_zstd=enabled', 34 | 'arrow-nanoarrow:device=enabled', 35 | 'arrow-nanoarrow:namespace=PythonPkg', 36 | 'zstd:bin_programs=false', 37 | ], 38 | ) 39 | 40 | subdir('src/nanoarrow') 41 | 42 | meson.add_dist_script('python', meson.current_source_dir() / 'generate_dist.py') 43 | -------------------------------------------------------------------------------- /python/pyproject.toml: -------------------------------------------------------------------------------- 1 | 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | [project] 20 | name = "nanoarrow" 21 | dynamic = ["version"] 22 | readme = "README.md" 23 | description = "Python bindings to the nanoarrow C library" 24 | authors = [{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}] 25 | maintainers = [{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}] 26 | license = {text = "Apache-2.0"} 27 | requires-python = ">=3.8" 28 | 29 | [project.optional-dependencies] 30 | test = ["pyarrow", "python-dateutil", "pytest", "numpy"] 31 | verify = ["python-dateutil", "pytest", "numpy"] 32 | 33 | [project.urls] 34 | Homepage = "https://arrow.apache.org" 35 | Repository = "https://github.com/apache/arrow-nanoarrow" 36 | Issues = "https://github.com/apache/arrow-nanoarrow/issues" 37 | Changelog = "https://github.com/apache/arrow-nanoarrow/blob/main/CHANGELOG.md" 38 | 39 | [build-system] 40 | requires = [ 41 | "meson>=1.3.0", 42 | "meson-python", 43 | "Cython" 44 | ] 45 | build-backend = "mesonpy" 46 | 47 | [tool.meson-python.args] 48 | install = ['--skip-subprojects'] 49 | dist = ['--include-subprojects'] 50 | 51 | [tool.pytest.ini_options] 52 | norecursedirs = "subprojects/arrow-nanoarrow" 53 | -------------------------------------------------------------------------------- /python/src/nanoarrow/_array.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # cython: language_level = 3 19 | 20 | from libc.stdint cimport int64_t 21 | 22 | from nanoarrow_c cimport ( 23 | ArrowArray, 24 | ArrowArrayView, 25 | ) 26 | 27 | from nanoarrow_device_c cimport ( 28 | ArrowDeviceArray, 29 | ArrowDeviceType 30 | ) 31 | 32 | from nanoarrow._device cimport CSharedSyncEvent 33 | from nanoarrow._schema cimport CSchema 34 | 35 | 36 | cdef class CArray: 37 | cdef object _base 38 | cdef ArrowArray* _ptr 39 | cdef CSchema _schema 40 | cdef ArrowDeviceType _device_type 41 | cdef int _device_id 42 | cdef void* _sync_event 43 | 44 | cdef _set_device(self, ArrowDeviceType device_type, int64_t device_id, void* sync_event) 45 | 46 | 47 | cdef class CArrayView: 48 | cdef object _base 49 | cdef object _array_base 50 | cdef ArrowArrayView* _ptr 51 | cdef CSharedSyncEvent _event 52 | 53 | cdef class CDeviceArray: 54 | cdef object _base 55 | cdef ArrowDeviceArray* _ptr 56 | cdef CSchema _schema 57 | -------------------------------------------------------------------------------- /python/src/nanoarrow/_device.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # cython: language_level = 3 19 | 20 | from libc.stdint cimport uintptr_t 21 | 22 | from nanoarrow_device_c cimport ArrowDevice 23 | 24 | cdef class Device: 25 | cdef object _base 26 | cdef ArrowDevice* _ptr 27 | 28 | cdef class CSharedSyncEvent: 29 | cdef Device device 30 | cdef void* sync_event 31 | 32 | cdef synchronize(self) 33 | cdef synchronize_stream(self, uintptr_t stream) 34 | -------------------------------------------------------------------------------- /python/src/nanoarrow/_static_version.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | # This file is part of 'miniver': https://github.com/jbweston/miniver 19 | 20 | # Replaced by version-bumping scripts at release time 21 | version = "0.7.0.dev0" 22 | 23 | # These values are only set if the distribution was created with 'git archive' 24 | refnames = "$Format:%D$" 25 | git_hash = "$Format:%h$" 26 | -------------------------------------------------------------------------------- /python/src/nanoarrow/_utils.pyi: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import _cython_3_0_11 19 | from typing import ClassVar 20 | 21 | __pyx_capi__: dict 22 | __reduce_cython__: _cython_3_0_11.cython_function_or_method 23 | __setstate_cython__: _cython_3_0_11.cython_function_or_method 24 | __test__: dict 25 | c_version: _cython_3_0_11.cython_function_or_method 26 | get_pyobject_buffer_count: _cython_3_0_11.cython_function_or_method 27 | obj_is_buffer: _cython_3_0_11.cython_function_or_method 28 | obj_is_capsule: _cython_3_0_11.cython_function_or_method 29 | 30 | class Error: 31 | __pyx_vtable__: ClassVar[PyCapsule] = ... 32 | @classmethod 33 | def __init__(cls, *args, **kwargs) -> None: 34 | """Create and return a new object. See help(type) for accurate signature.""" 35 | def __reduce__(self): ... 36 | 37 | class NanoarrowException(RuntimeError): 38 | def __init__(self, *args, **kwargs) -> None: ... 39 | -------------------------------------------------------------------------------- /python/src/nanoarrow/_version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # This file is part of 'miniver': https://github.com/jbweston/miniver 21 | 22 | import os 23 | 24 | # No public API 25 | __all__ = [] 26 | 27 | package_root = os.path.dirname(os.path.realpath(__file__)) 28 | package_name = os.path.basename(package_root) 29 | 30 | STATIC_VERSION_FILE = "_static_version.py" 31 | 32 | 33 | def get_version(version_file=STATIC_VERSION_FILE): 34 | override = os.environ.get("SETUPTOOLS_SCM_PRETEND_VERSION") 35 | if override is not None and override != "": 36 | return override 37 | version_info = get_static_version_info(version_file) 38 | version = version_info["version"] 39 | return version 40 | 41 | 42 | def get_static_version_info(version_file=STATIC_VERSION_FILE): 43 | version_info = {} 44 | with open(os.path.join(package_root, version_file), "rb") as f: 45 | exec(f.read(), {}, version_info) 46 | return version_info 47 | 48 | 49 | __version__ = get_version() 50 | 51 | if __name__ == "__main__": 52 | print(get_version()) 53 | -------------------------------------------------------------------------------- /python/subprojects/arrow-nanoarrow: -------------------------------------------------------------------------------- 1 | ../.. -------------------------------------------------------------------------------- /python/subprojects/flatcc.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = flatcc-fd3c4ae5cd39f0651eda6a3a1a374278070135d6 20 | source_url = https://github.com/dvidelabs/flatcc/archive/fd3c4ae5cd39f0651eda6a3a1a374278070135d6.tar.gz 21 | source_filename = flatcc-fd3c4ae5cd39f0651eda6a3a1a374278070135d6.tar.gz 22 | source_hash = 353cb04a619865383b87c8077eb39b63b01a3fc44f7bebd558a88f139c6b6f77 23 | patch_directory = flatcc 24 | 25 | [provide] 26 | flatcc = flatcc_dep 27 | -------------------------------------------------------------------------------- /python/subprojects/packagefiles/flatcc/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project('flatcc', 'c', version: '0.6.1', license: 'Apache-2.0') 19 | 20 | incdir = include_directories('include') 21 | 22 | flatcc_lib = library( 23 | 'flatcc', 24 | sources: [ 25 | 'src/runtime/builder.c', 26 | 'src/runtime/emitter.c', 27 | 'src/runtime/verifier.c', 28 | 'src/runtime/refmap.c', 29 | ], 30 | include_directories: [incdir], 31 | ) 32 | 33 | flatcc_dep = declare_dependency( 34 | include_directories: [incdir], 35 | link_with: [flatcc_lib], 36 | ) 37 | -------------------------------------------------------------------------------- /python/subprojects/zstd.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = zstd-1.5.6 20 | source_url = https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz 21 | source_filename = zstd-1.5.6.tar.gz 22 | source_hash = 8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 23 | patch_filename = zstd_1.5.6-2_patch.zip 24 | patch_url = https://wrapdb.mesonbuild.com/v2/zstd_1.5.6-2/get_patch 25 | patch_hash = 3e67f7d2edf3c56e6450d4c0f5f3d5fe94799e3608e3795502da03f7dd51b28c 26 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zstd_1.5.6-2/zstd-1.5.6.tar.gz 27 | wrapdb_version = 1.5.6-2 28 | 29 | [provide] 30 | libzstd = libzstd_dep 31 | -------------------------------------------------------------------------------- /python/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import pytest 19 | 20 | 21 | @pytest.fixture 22 | def cuda_device(): 23 | from nanoarrow.device import DeviceType, resolve 24 | 25 | try: 26 | return resolve(DeviceType.CUDA, 0) 27 | except ValueError: 28 | return None 29 | -------------------------------------------------------------------------------- /python/tests/test_version.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import importlib 19 | import re 20 | 21 | import nanoarrow as na 22 | 23 | 24 | def test_version(): 25 | re_py_version = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+)?$") 26 | assert re_py_version.match(na.__version__) is not None 27 | 28 | 29 | def test_c_version(): 30 | re_version = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$") 31 | assert re_version.match(na.c_version()) is not None 32 | 33 | 34 | def test_metadata_version(): 35 | assert importlib.metadata.version("nanoarrow") == na.__version__ 36 | -------------------------------------------------------------------------------- /r/.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^nanoarrow\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^LICENSE\.md$ 4 | ^_pkgdown\.yml$ 5 | ^docs$ 6 | ^pkgdown$ 7 | ^\.\./docs/_build/html$ 8 | ^README\.Rmd$ 9 | ^\.vscode$ 10 | ^\.covrignore$ 11 | ^cran-comments\.md$ 12 | ^bootstrap\.R$ 13 | ^\.cache$ 14 | ^compile_commands\.json$ 15 | ^src/Makevars$ 16 | ^configure\.win$ 17 | -------------------------------------------------------------------------------- /r/.covrignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | src/nanoarrow.c 19 | src/nanoarrow.h 20 | src/nanoarrow_ipc.h 21 | src/nanoarrow_ipc.c 22 | src/flatcc* 23 | -------------------------------------------------------------------------------- /r/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | .Rproj.user 19 | .Rhistory 20 | docs 21 | compile_commands.json 22 | -------------------------------------------------------------------------------- /r/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: nanoarrow 2 | Title: Interface to the 'nanoarrow' 'C' Library 3 | Version: 0.6.0.9000 4 | Authors@R: c( 5 | person(given = "Dewey", 6 | family = "Dunnington", 7 | role = c("aut", "cre"), 8 | email = "dewey@dunnington.ca", 9 | comment = c(ORCID = "0000-0002-9415-4582")), 10 | person("Apache Arrow", email = "dev@arrow.apache.org", role = c("aut", "cph")), 11 | person("Apache Software Foundation", email = "dev@arrow.apache.org", role = c("cph")) 12 | ) 13 | Description: Provides an 'R' interface to the 'nanoarrow' 'C' library and the 14 | 'Apache Arrow' application binary interface. Functions to import and 15 | export 'ArrowArray', 'ArrowSchema', and 'ArrowArrayStream' 'C' structures 16 | to and from 'R' objects are provided alongside helpers to facilitate zero-copy 17 | data transfer among 'R' bindings to libraries implementing the 'Arrow' 'C' 18 | data interface. 19 | License: Apache License (>= 2) 20 | Encoding: UTF-8 21 | Roxygen: list(markdown = TRUE) 22 | RoxygenNote: 7.3.2 23 | URL: https://arrow.apache.org/nanoarrow/latest/r/, https://github.com/apache/arrow-nanoarrow 24 | BugReports: https://github.com/apache/arrow-nanoarrow/issues 25 | Suggests: 26 | arrow (>= 9.0.0), 27 | bit64, 28 | blob, 29 | dplyr, 30 | hms, 31 | jsonlite, 32 | rlang, 33 | testthat (>= 3.0.0), 34 | tibble, 35 | vctrs, 36 | withr 37 | SystemRequirements: libzstd (optional) 38 | Config/testthat/edition: 3 39 | Config/build/bootstrap: TRUE 40 | -------------------------------------------------------------------------------- /r/R/altrep.R: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # For testing the altrep chr conversion 19 | nanoarrow_altrep_chr <- function(array) { 20 | .Call(nanoarrow_c_make_altrep_chr, array) 21 | } 22 | 23 | is_nanoarrow_altrep <- function(x) { 24 | .Call(nanoarrow_c_is_altrep, x) 25 | } 26 | 27 | nanoarrow_altrep_force_materialize <- function(x, recursive = FALSE) { 28 | invisible(.Call(nanoarrow_c_altrep_force_materialize, x, recursive)) 29 | } 30 | 31 | is_nanoarrow_altrep_materialized <- function(x) { 32 | .Call(nanoarrow_c_altrep_is_materialized, x) 33 | } 34 | -------------------------------------------------------------------------------- /r/R/nanoarrow-package.R: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | #' @keywords internal 19 | "_PACKAGE" 20 | 21 | ## usethis namespace: start 22 | #' @importFrom utils getFromNamespace 23 | #' @useDynLib nanoarrow, .registration = TRUE 24 | ## usethis namespace: end 25 | NULL 26 | 27 | #' Underlying 'nanoarrow' C library build 28 | #' 29 | #' @param runtime Compare TRUE and FALSE values to detect a 30 | #' possible ABI mismatch. 31 | #' 32 | #' @return A string identifying the version of nanoarrow this package 33 | #' was compiled against. 34 | #' @export 35 | #' 36 | #' @examples 37 | #' nanoarrow_version() 38 | #' nanoarrow_with_zstd() 39 | nanoarrow_version <- function(runtime = TRUE) { 40 | if (runtime) { 41 | .Call(nanoarrow_c_version_runtime) 42 | } else { 43 | .Call(nanoarrow_c_version) 44 | } 45 | } 46 | 47 | #' @rdname nanoarrow_version 48 | #' @export 49 | nanoarrow_with_zstd <- function() { 50 | .Call(nanoarrow_c_with_zstd) 51 | } 52 | -------------------------------------------------------------------------------- /r/_pkgdown.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | url: ~ 19 | template: 20 | bootstrap: 5 21 | destination: ../docs/_build/html/r 22 | 23 | repo: 24 | url: 25 | home: https://github.com/apache/arrow-nanoarrow/ 26 | source: https://github.com/apache/arrow-nanoarrow/blob/main/r/ 27 | issue: https://github.com/apache/arrow-nanoarrow/issues/ 28 | user: https://github.com/ 29 | -------------------------------------------------------------------------------- /r/configure.win: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # Just call the original configure script 19 | ./configure 20 | -------------------------------------------------------------------------------- /r/cran-comments.md: -------------------------------------------------------------------------------- 1 | 2 | Updates the nanoarrow R bindings to use the latest version of the nanoarrow 3 | C library. 4 | 5 | ## R CMD check results 6 | 7 | 0 errors | 0 warnings | 0 notes 8 | -------------------------------------------------------------------------------- /r/man/array_stream_set_finalizer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/array-stream.R 3 | \name{array_stream_set_finalizer} 4 | \alias{array_stream_set_finalizer} 5 | \title{Register an array stream finalizer} 6 | \usage{ 7 | array_stream_set_finalizer(array_stream, finalizer) 8 | } 9 | \arguments{ 10 | \item{array_stream}{A \link[=as_nanoarrow_array_stream]{nanoarrow_array_stream}} 11 | 12 | \item{finalizer}{A function that will be called with zero arguments.} 13 | } 14 | \value{ 15 | A newly allocated \code{array_stream} whose release callback will call 16 | the supplied finalizer. 17 | } 18 | \description{ 19 | In some cases, R functions that return a \link[=as_nanoarrow_array_stream]{nanoarrow_array_stream} 20 | may require that the scope of some other object outlive that of the array 21 | stream. If there is a need for that object to be released deterministically 22 | (e.g., to close open files), you can register a function to run after the 23 | stream's release callback is invoked from the R thread. Note that this 24 | finalizer will \strong{not} be run if the stream's release callback is invoked 25 | from a \strong{non}-R thread. In this case, the finalizer and its chain of 26 | environments will be garbage-collected when \code{nanoarrow:::preserved_empty()} 27 | is run. 28 | } 29 | \examples{ 30 | stream <- array_stream_set_finalizer( 31 | basic_array_stream(list(1:5)), 32 | function() message("All done!") 33 | ) 34 | stream$release() 35 | 36 | } 37 | -------------------------------------------------------------------------------- /r/man/as_nanoarrow_array.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/array.R 3 | \name{as_nanoarrow_array} 4 | \alias{as_nanoarrow_array} 5 | \title{Convert an object to a nanoarrow array} 6 | \usage{ 7 | as_nanoarrow_array(x, ..., schema = NULL) 8 | } 9 | \arguments{ 10 | \item{x}{An object to convert to a array} 11 | 12 | \item{...}{Passed to S3 methods} 13 | 14 | \item{schema}{An optional schema used to enforce conversion to a particular 15 | type. Defaults to \code{\link[=infer_nanoarrow_schema]{infer_nanoarrow_schema()}}.} 16 | } 17 | \value{ 18 | An object of class 'nanoarrow_array' 19 | } 20 | \description{ 21 | In nanoarrow an 'array' refers to the \verb{struct ArrowArray} definition 22 | in the Arrow C data interface. At the R level, we attach a 23 | \link[=as_nanoarrow_schema]{schema} such that functionally the nanoarrow_array 24 | class can be used in a similar way as an \code{arrow::Array}. Note that in 25 | nanoarrow an \code{arrow::RecordBatch} and a non-nullable \code{arrow::StructArray} 26 | are represented identically. 27 | } 28 | \examples{ 29 | (array <- as_nanoarrow_array(1:5)) 30 | as.vector(array) 31 | 32 | (array <- as_nanoarrow_array(data.frame(x = 1:5))) 33 | as.data.frame(array) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /r/man/as_nanoarrow_array_stream.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/array-stream.R 3 | \name{as_nanoarrow_array_stream} 4 | \alias{as_nanoarrow_array_stream} 5 | \title{Convert an object to a nanoarrow array_stream} 6 | \usage{ 7 | as_nanoarrow_array_stream(x, ..., schema = NULL) 8 | } 9 | \arguments{ 10 | \item{x}{An object to convert to a array_stream} 11 | 12 | \item{...}{Passed to S3 methods} 13 | 14 | \item{schema}{An optional schema used to enforce conversion to a particular 15 | type. Defaults to \code{\link[=infer_nanoarrow_schema]{infer_nanoarrow_schema()}}.} 16 | } 17 | \value{ 18 | An object of class 'nanoarrow_array_stream' 19 | } 20 | \description{ 21 | In nanoarrow, an 'array stream' corresponds to the \verb{struct ArrowArrayStream} 22 | as defined in the Arrow C Stream interface. This object is used to represent 23 | a stream of \link[=as_nanoarrow_array]{arrays} with a common 24 | \link[=as_nanoarrow_schema]{schema}. This is similar to an 25 | \link[arrow:RecordBatchReader]{arrow::RecordBatchReader} except it can be used to represent a stream of 26 | any type (not just record batches). Note that a stream of record batches 27 | and a stream of non-nullable struct arrays are represented identically. 28 | Also note that array streams are mutable objects and are passed by 29 | reference and not by value. 30 | } 31 | \examples{ 32 | (stream <- as_nanoarrow_array_stream(data.frame(x = 1:5))) 33 | stream$get_schema() 34 | stream$get_next() 35 | 36 | # The last batch is returned as NULL 37 | stream$get_next() 38 | 39 | # Release the stream 40 | stream$release() 41 | 42 | } 43 | -------------------------------------------------------------------------------- /r/man/as_nanoarrow_buffer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buffer.R 3 | \name{as_nanoarrow_buffer} 4 | \alias{as_nanoarrow_buffer} 5 | \title{Convert an object to a nanoarrow buffer} 6 | \usage{ 7 | as_nanoarrow_buffer(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object to convert to a buffer} 11 | 12 | \item{...}{Passed to S3 methods} 13 | } 14 | \value{ 15 | An object of class 'nanoarrow_buffer' 16 | } 17 | \description{ 18 | Convert an object to a nanoarrow buffer 19 | } 20 | \examples{ 21 | array <- as_nanoarrow_array(c(NA, 1:4)) 22 | array$buffers 23 | as.raw(array$buffers[[1]]) 24 | as.raw(array$buffers[[2]]) 25 | convert_buffer(array$buffers[[1]]) 26 | convert_buffer(array$buffers[[2]]) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /r/man/as_nanoarrow_schema.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/schema.R 3 | \name{as_nanoarrow_schema} 4 | \alias{as_nanoarrow_schema} 5 | \alias{infer_nanoarrow_schema} 6 | \alias{nanoarrow_schema_parse} 7 | \alias{nanoarrow_schema_modify} 8 | \title{Convert an object to a nanoarrow schema} 9 | \usage{ 10 | as_nanoarrow_schema(x, ...) 11 | 12 | infer_nanoarrow_schema(x, ...) 13 | 14 | nanoarrow_schema_parse(x, recursive = FALSE) 15 | 16 | nanoarrow_schema_modify(x, new_values, validate = TRUE) 17 | } 18 | \arguments{ 19 | \item{x}{An object to convert to a schema} 20 | 21 | \item{...}{Passed to S3 methods} 22 | 23 | \item{recursive}{Use \code{TRUE} to include a \code{children} member when parsing 24 | schemas.} 25 | 26 | \item{new_values}{New schema component to assign} 27 | 28 | \item{validate}{Use \code{FALSE} to skip schema validation} 29 | } 30 | \value{ 31 | An object of class 'nanoarrow_schema' 32 | } 33 | \description{ 34 | In nanoarrow a 'schema' refers to a \verb{struct ArrowSchema} as defined in the 35 | Arrow C Data interface. This data structure can be used to represent an 36 | \code{\link[arrow:schema]{arrow::schema()}}, an \code{\link[arrow:Field]{arrow::field()}}, or an \code{arrow::DataType}. Note that 37 | in nanoarrow, an \code{\link[arrow:schema]{arrow::schema()}} and a non-nullable \code{\link[arrow:data-type]{arrow::struct()}} 38 | are represented identically. 39 | } 40 | \examples{ 41 | infer_nanoarrow_schema(integer()) 42 | infer_nanoarrow_schema(data.frame(x = integer())) 43 | 44 | } 45 | -------------------------------------------------------------------------------- /r/man/basic_array_stream.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/array-stream.R 3 | \name{basic_array_stream} 4 | \alias{basic_array_stream} 5 | \title{Create ArrayStreams from batches} 6 | \usage{ 7 | basic_array_stream(batches, schema = NULL, validate = TRUE) 8 | } 9 | \arguments{ 10 | \item{batches}{A \code{\link[=list]{list()}} of \link[=as_nanoarrow_array]{nanoarrow_array} objects 11 | or objects that can be coerced via \code{\link[=as_nanoarrow_array]{as_nanoarrow_array()}}.} 12 | 13 | \item{schema}{A \link[=as_nanoarrow_schema]{nanoarrow_schema} or \code{NULL} to guess 14 | based on the first schema.} 15 | 16 | \item{validate}{Use \code{FALSE} to skip the validation step (i.e., if you 17 | know that the arrays are valid).} 18 | } 19 | \value{ 20 | An \link[=as_nanoarrow_array_stream]{nanoarrow_array_stream} 21 | } 22 | \description{ 23 | Create ArrayStreams from batches 24 | } 25 | \examples{ 26 | (stream <- basic_array_stream(list(data.frame(a = 1, b = 2)))) 27 | as.data.frame(stream$get_next()) 28 | stream$get_next() 29 | 30 | } 31 | -------------------------------------------------------------------------------- /r/man/example_ipc_stream.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ipc.R 3 | \name{example_ipc_stream} 4 | \alias{example_ipc_stream} 5 | \title{Example Arrow IPC Data} 6 | \usage{ 7 | example_ipc_stream(compression = c("none", "zstd")) 8 | } 9 | \arguments{ 10 | \item{compression}{One of "none" or "zstd"} 11 | } 12 | \value{ 13 | A raw vector that can be passed to \code{\link[=read_nanoarrow]{read_nanoarrow()}} 14 | } 15 | \description{ 16 | An example stream that can be used for testing or examples. 17 | } 18 | \examples{ 19 | as.data.frame(read_nanoarrow(example_ipc_stream())) 20 | } 21 | -------------------------------------------------------------------------------- /r/man/infer_nanoarrow_ptype.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/infer-ptype.R 3 | \name{infer_nanoarrow_ptype} 4 | \alias{infer_nanoarrow_ptype} 5 | \title{Infer an R vector prototype} 6 | \usage{ 7 | infer_nanoarrow_ptype(x) 8 | } 9 | \arguments{ 10 | \item{x}{A \link[=as_nanoarrow_schema]{nanoarrow_schema}, 11 | \link[=as_nanoarrow_array]{nanoarrow_array}, or 12 | \link[=as_nanoarrow_array_stream]{nanoarrow_array_stream}.} 13 | } 14 | \value{ 15 | An R vector of zero size describing the target into which 16 | the array should be materialized. 17 | } 18 | \description{ 19 | Resolves the default \code{to} value to use in \code{\link[=convert_array]{convert_array()}} and 20 | \code{\link[=convert_array_stream]{convert_array_stream()}}. The default conversions are: 21 | } 22 | \details{ 23 | \itemize{ 24 | \item null to \code{\link[vctrs:unspecified]{vctrs::unspecified()}} 25 | \item boolean to \code{\link[=logical]{logical()}} 26 | \item int8, uint8, int16, uint16, and int13 to \code{\link[=integer]{integer()}} 27 | \item uint32, int64, uint64, float, and double to \code{\link[=double]{double()}} 28 | \item string and large string to \code{\link[=character]{character()}} 29 | \item struct to \code{\link[=data.frame]{data.frame()}} 30 | \item binary and large binary to \code{\link[blob:blob]{blob::blob()}} 31 | \item list, large_list, and fixed_size_list to \code{\link[vctrs:list_of]{vctrs::list_of()}} 32 | \item time32 and time64 to \code{\link[hms:hms]{hms::hms()}} 33 | \item duration to \code{\link[=difftime]{difftime()}} 34 | \item date32 to \code{\link[=as.Date]{as.Date()}} 35 | \item timestamp to \code{\link[=as.POSIXct]{as.POSIXct()}} 36 | } 37 | 38 | Additional conversions are possible by specifying an explicit value for 39 | \code{to}. For details of each conversion, see \code{\link[=convert_array]{convert_array()}}. 40 | } 41 | \examples{ 42 | infer_nanoarrow_ptype(as_nanoarrow_array(1:10)) 43 | 44 | } 45 | -------------------------------------------------------------------------------- /r/man/infer_nanoarrow_ptype_extension.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extension.R 3 | \name{infer_nanoarrow_ptype_extension} 4 | \alias{infer_nanoarrow_ptype_extension} 5 | \alias{convert_array_extension} 6 | \alias{as_nanoarrow_array_extension} 7 | \title{Implement Arrow extension types} 8 | \usage{ 9 | infer_nanoarrow_ptype_extension( 10 | extension_spec, 11 | x, 12 | ..., 13 | warn_unregistered = TRUE 14 | ) 15 | 16 | convert_array_extension( 17 | extension_spec, 18 | array, 19 | to, 20 | ..., 21 | warn_unregistered = TRUE 22 | ) 23 | 24 | as_nanoarrow_array_extension(extension_spec, x, ..., schema = NULL) 25 | } 26 | \arguments{ 27 | \item{extension_spec}{An extension specification inheriting from 28 | 'nanoarrow_extension_spec'.} 29 | 30 | \item{x, array, to, schema, ...}{Passed from \code{\link[=infer_nanoarrow_ptype]{infer_nanoarrow_ptype()}}, 31 | \code{\link[=convert_array]{convert_array()}}, \code{\link[=as_nanoarrow_array]{as_nanoarrow_array()}}, and/or 32 | \code{\link[=as_nanoarrow_array_stream]{as_nanoarrow_array_stream()}}.} 33 | 34 | \item{warn_unregistered}{Use \code{FALSE} to infer/convert based on the storage 35 | type without a warning.} 36 | } 37 | \value{ 38 | \itemize{ 39 | \item \code{infer_nanoarrow_ptype_extension()}: The R vector prototype to be used 40 | as the default conversion target. 41 | \item \code{convert_array_extension()}: An R vector of type \code{to}. 42 | \item \code{as_nanoarrow_array_extension()}: A \link[=as_nanoarrow_array]{nanoarrow_array} 43 | of type \code{schema}. 44 | } 45 | } 46 | \description{ 47 | Implement Arrow extension types 48 | } 49 | -------------------------------------------------------------------------------- /r/man/na_vctrs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extension-vctrs.R 3 | \name{na_vctrs} 4 | \alias{na_vctrs} 5 | \title{Vctrs extension type} 6 | \usage{ 7 | na_vctrs(ptype, storage_type = NULL) 8 | } 9 | \arguments{ 10 | \item{ptype}{A vctrs prototype as returned by \code{\link[vctrs:vec_ptype]{vctrs::vec_ptype()}}. 11 | The prototype can be of arbitrary size, but a zero-size vector 12 | is sufficient here.} 13 | 14 | \item{storage_type}{For \code{\link[=na_extension]{na_extension()}}, the underlying value type.} 15 | } 16 | \value{ 17 | A \link[=as_nanoarrow_schema]{nanoarrow_schema}. 18 | } 19 | \description{ 20 | The Arrow format provides a rich type system that can handle most R 21 | vector types; however, many R vector types do not roundtrip perfectly 22 | through Arrow memory. The vctrs extension type uses \code{\link[vctrs:vec_data]{vctrs::vec_data()}}, 23 | \code{\link[vctrs:vec_proxy]{vctrs::vec_restore()}}, and \code{\link[vctrs:vec_ptype]{vctrs::vec_ptype()}} in calls to 24 | \code{\link[=as_nanoarrow_array]{as_nanoarrow_array()}} and \code{\link[=convert_array]{convert_array()}} to ensure roundtrip fidelity. 25 | } 26 | \examples{ 27 | \dontshow{if (requireNamespace("jsonlite", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} 28 | vctr <- as.POSIXlt("2000-01-02 03:45", tz = "UTC") 29 | array <- as_nanoarrow_array(vctr, schema = na_vctrs(vctr)) 30 | infer_nanoarrow_ptype(array) 31 | convert_array(array) 32 | \dontshow{\}) # examplesIf} 33 | } 34 | -------------------------------------------------------------------------------- /r/man/nanoarrow-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nanoarrow-package.R 3 | \docType{package} 4 | \name{nanoarrow-package} 5 | \alias{nanoarrow} 6 | \alias{nanoarrow-package} 7 | \title{nanoarrow: Interface to the 'nanoarrow' 'C' Library} 8 | \description{ 9 | Provides an 'R' interface to the 'nanoarrow' 'C' library and the 'Apache Arrow' application binary interface. Functions to import and export 'ArrowArray', 'ArrowSchema', and 'ArrowArrayStream' 'C' structures to and from 'R' objects are provided alongside helpers to facilitate zero-copy data transfer among 'R' bindings to libraries implementing the 'Arrow' 'C' data interface. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://arrow.apache.org/nanoarrow/latest/r/} 15 | \item \url{https://github.com/apache/arrow-nanoarrow} 16 | \item Report bugs at \url{https://github.com/apache/arrow-nanoarrow/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Dewey Dunnington \email{dewey@dunnington.ca} (\href{https://orcid.org/0000-0002-9415-4582}{ORCID}) 22 | 23 | Authors: 24 | \itemize{ 25 | \item Apache Arrow \email{dev@arrow.apache.org} [copyright holder] 26 | } 27 | 28 | Other contributors: 29 | \itemize{ 30 | \item Apache Software Foundation \email{dev@arrow.apache.org} [copyright holder] 31 | } 32 | 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /r/man/nanoarrow_buffer_init.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buffer.R 3 | \name{nanoarrow_buffer_init} 4 | \alias{nanoarrow_buffer_init} 5 | \alias{nanoarrow_buffer_append} 6 | \alias{convert_buffer} 7 | \title{Create and modify nanoarrow buffers} 8 | \usage{ 9 | nanoarrow_buffer_init() 10 | 11 | nanoarrow_buffer_append(buffer, new_buffer) 12 | 13 | convert_buffer(buffer, to = NULL) 14 | } 15 | \arguments{ 16 | \item{buffer, new_buffer}{\link[=as_nanoarrow_buffer]{nanoarrow_buffer}s.} 17 | 18 | \item{to}{A target prototype object describing the type to which \code{array} 19 | should be converted, or \code{NULL} to use the default conversion as 20 | returned by \code{\link[=infer_nanoarrow_ptype]{infer_nanoarrow_ptype()}}. Alternatively, a function can be 21 | passed to perform an alternative calculation of the default ptype as 22 | a function of \code{array} and the default inference of the prototype.} 23 | } 24 | \value{ 25 | \itemize{ 26 | \item \code{nanoarrow_buffer_init()}: An object of class 'nanoarrow_buffer' 27 | \item \code{nanoarrow_buffer_append()}: Returns \code{buffer}, invisibly. Note that 28 | \code{buffer} is modified in place by reference. 29 | } 30 | } 31 | \description{ 32 | Create and modify nanoarrow buffers 33 | } 34 | \examples{ 35 | buffer <- nanoarrow_buffer_init() 36 | nanoarrow_buffer_append(buffer, 1:5) 37 | 38 | array <- nanoarrow_array_modify( 39 | nanoarrow_array_init(na_int32()), 40 | list(length = 5, buffers = list(NULL, buffer)) 41 | ) 42 | as.vector(array) 43 | 44 | } 45 | -------------------------------------------------------------------------------- /r/man/nanoarrow_extension_array.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extension.R 3 | \name{nanoarrow_extension_array} 4 | \alias{nanoarrow_extension_array} 5 | \title{Create Arrow extension arrays} 6 | \usage{ 7 | nanoarrow_extension_array( 8 | storage_array, 9 | extension_name, 10 | extension_metadata = NULL 11 | ) 12 | } 13 | \arguments{ 14 | \item{storage_array}{A \link[=as_nanoarrow_array]{nanoarrow_array}.} 15 | 16 | \item{extension_name}{For \code{\link[=na_extension]{na_extension()}}, the extension name. This is 17 | typically namespaced separated by dots (e.g., nanoarrow.r.vctrs).} 18 | 19 | \item{extension_metadata}{A string or raw vector defining extension metadata. 20 | Most Arrow extension types define extension metadata as a JSON object.} 21 | } 22 | \value{ 23 | A \link[=as_nanoarrow_array]{nanoarrow_array} with attached extension 24 | schema. 25 | } 26 | \description{ 27 | Create Arrow extension arrays 28 | } 29 | \examples{ 30 | nanoarrow_extension_array(1:10, "some_ext", '{"key": "value"}') 31 | 32 | } 33 | -------------------------------------------------------------------------------- /r/man/nanoarrow_extension_spec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extension.R 3 | \name{nanoarrow_extension_spec} 4 | \alias{nanoarrow_extension_spec} 5 | \alias{register_nanoarrow_extension} 6 | \alias{unregister_nanoarrow_extension} 7 | \alias{resolve_nanoarrow_extension} 8 | \title{Register Arrow extension types} 9 | \usage{ 10 | nanoarrow_extension_spec(data = list(), subclass = character()) 11 | 12 | register_nanoarrow_extension(extension_name, extension_spec) 13 | 14 | unregister_nanoarrow_extension(extension_name) 15 | 16 | resolve_nanoarrow_extension(extension_name) 17 | } 18 | \arguments{ 19 | \item{data}{Optional data to include in the extension type specification} 20 | 21 | \item{subclass}{A subclass for the extension type specification. Extension 22 | methods will dispatch on this object.} 23 | 24 | \item{extension_name}{An Arrow extension type name (e.g., nanoarrow.r.vctrs)} 25 | 26 | \item{extension_spec}{An extension specification inheriting from 27 | 'nanoarrow_extension_spec'.} 28 | } 29 | \value{ 30 | \itemize{ 31 | \item \code{nanoarrow_extension_spec()} returns an object of class 32 | 'nanoarrow_extension_spec'. 33 | \item \code{register_nanoarrow_extension()} returns \code{extension_spec}, invisibly. 34 | \item \code{unregister_nanoarrow_extension()} returns \code{extension_name}, invisibly. 35 | \item \code{resolve_nanoarrow_extension()} returns an object of class 36 | 'nanoarrow_extension_spec' or NULL if the extension type was not 37 | registered. 38 | } 39 | } 40 | \description{ 41 | Register Arrow extension types 42 | } 43 | \examples{ 44 | nanoarrow_extension_spec("mynamespace.mytype", subclass = "mypackage_mytype_spec") 45 | } 46 | -------------------------------------------------------------------------------- /r/man/nanoarrow_version.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nanoarrow-package.R 3 | \name{nanoarrow_version} 4 | \alias{nanoarrow_version} 5 | \alias{nanoarrow_with_zstd} 6 | \title{Underlying 'nanoarrow' C library build} 7 | \usage{ 8 | nanoarrow_version(runtime = TRUE) 9 | 10 | nanoarrow_with_zstd() 11 | } 12 | \arguments{ 13 | \item{runtime}{Compare TRUE and FALSE values to detect a 14 | possible ABI mismatch.} 15 | } 16 | \value{ 17 | A string identifying the version of nanoarrow this package 18 | was compiled against. 19 | } 20 | \description{ 21 | Underlying 'nanoarrow' C library build 22 | } 23 | \examples{ 24 | nanoarrow_version() 25 | nanoarrow_with_zstd() 26 | } 27 | -------------------------------------------------------------------------------- /r/nanoarrow.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: 66584247-a2ea-4bae-bcbd-86d4e09bc627 3 | 4 | RestoreWorkspace: No 5 | SaveWorkspace: No 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: Sweave 14 | LaTeX: pdfLaTeX 15 | 16 | AutoAppendNewline: Yes 17 | StripTrailingWhitespace: Yes 18 | LineEndingConversion: Posix 19 | 20 | BuildType: Package 21 | PackageUseDevtools: Yes 22 | PackageInstallArgs: --no-multiarch --with-keep.source 23 | PackageRoxygenize: rd,collate,namespace 24 | -------------------------------------------------------------------------------- /r/src/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | *.o 19 | *.so 20 | *.dll 21 | nanoarrow.c 22 | nanoarrow.h 23 | nanoarrow_ipc.h 24 | nanoarrow_ipc.c 25 | flatcc* 26 | Makevars 27 | -------------------------------------------------------------------------------- /r/src/Makevars.in: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # -DFLATCC_USE_GENERIC_ALIGNED_ALLOC is needed to support compilation on systems 19 | # that do not provide aligned_alloc. Allocating flatbuffers memory is not 20 | # performance-critical for what we do in the nanoarrow R package (and may not 21 | # occur at all until IPC write support is added) 22 | 23 | PKG_CPPFLAGS=-I../inst/include -I../src -DFLATCC_USE_GENERIC_ALIGNED_ALLOC @cppflags@ 24 | PKG_LIBS=@libs@ 25 | -------------------------------------------------------------------------------- /r/src/Makevars.ucrt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # This Makevars handles R >= 4.2 on Windows (pkg-config is available on all such versions) 19 | 20 | ifeq (,$(shell pkg-config libzstd --libs 2>/dev/null)) 21 | ZSTD_CFLAGS = 22 | ZSTD_LIB_FLAGS = 23 | else 24 | ZSTD_CFLAGS = $(shell pkg-config --cflags libzstd) -DNANOARROW_IPC_WITH_ZSTD 25 | ZSTD_LIB_FLAGS = $(shell pkg-config --libs libzstd) 26 | endif 27 | 28 | PKG_CPPFLAGS = -I../inst/include -I../src -DFLATCC_USE_GENERIC_ALIGNED_ALLOC $(ZSTD_CFLAGS) 29 | PKG_LIBS = $(ZSTD_LIB_FLAGS) 30 | -------------------------------------------------------------------------------- /r/src/Makevars.win: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # This Makevars handles R 4.0 and 4.1 on Windows. These packages are no longer built 19 | # by CRAN, but on GitHub Actions pkg-config seems to be able to resolve and link a 20 | # zstd that works on 64-bit (but not 32-bit). 21 | 22 | ifeq (,$(shell pkg-config libzstd --libs 2>/dev/null)) 23 | ZSTD_CFLAGS = 24 | ZSTD_LIB_FLAGS = 25 | else 26 | ifeq "$(WIN)" "64" 27 | ZSTD_CFLAGS = $(shell pkg-config --cflags libzstd) -DNANOARROW_IPC_WITH_ZSTD 28 | ZSTD_LIB_FLAGS = $(shell pkg-config --libs libzstd) 29 | else 30 | ZSTD_CFLAGS = 31 | ZSTD_LIB_FLAGS = 32 | endif 33 | endif 34 | 35 | PKG_CPPFLAGS = -I../inst/include -I../src -DFLATCC_USE_GENERIC_ALIGNED_ALLOC $(ZSTD_CFLAGS) 36 | PKG_LIBS = $(ZSTD_LIB_FLAGS) 37 | -------------------------------------------------------------------------------- /r/src/altrep.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #ifndef R_ALTREP_H_INCLUDED 19 | #define R_ALTREP_H_INCLUDED 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | // Needs to be at the end of the R include list 26 | #include 27 | 28 | #include 29 | 30 | // Returns the ALTREP class name or NULL if x is not an altrep 31 | // object. 32 | static inline const char* nanoarrow_altrep_class(SEXP x) { 33 | if (ALTREP(x)) { 34 | SEXP data_class_sym = CAR(ATTRIB(ALTREP_CLASS(x))); 35 | return CHAR(PRINTNAME(data_class_sym)); 36 | } else { 37 | return NULL; 38 | } 39 | } 40 | 41 | // Performs the ALTREP type registration and should be called on package load 42 | void register_nanoarrow_altrep(DllInfo* info); 43 | 44 | // Checks if an object is an ALTREP object created by this package 45 | static inline int is_nanoarrow_altrep(SEXP x) { 46 | const char* class_name = nanoarrow_altrep_class(x); 47 | return class_name && strncmp(class_name, "nanoarrow::", 11) == 0; 48 | } 49 | 50 | // Creates an altstring vector backed by a nanoarrow array or returns 51 | // R_NilValue if the conversion is not possible. 52 | SEXP nanoarrow_c_make_altrep_chr(SEXP array_xptr); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /r/src/array_stream.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #ifndef R_NANOARROW_ARRAY_STREAM_H_INCLUDED 19 | #define R_NANOARROW_ARRAY_STREAM_H_INCLUDED 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | #include "nanoarrow.h" 26 | #include "util.h" 27 | 28 | void array_stream_export(SEXP array_stream_xptr, 29 | struct ArrowArrayStream* array_stream_copy); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /r/src/materialize_date.h: -------------------------------------------------------------------------------- 1 | 2 | // Licensed to the Apache Software Foundation (ASF) under one 3 | // or more contributor license agreements. See the NOTICE file 4 | // distributed with this work for additional information 5 | // regarding copyright ownership. The ASF licenses this file 6 | // to you under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in compliance 8 | // with the License. You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, 13 | // software distributed under the License is distributed on an 14 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | // KIND, either express or implied. See the License for the 16 | // specific language governing permissions and limitations 17 | // under the License. 18 | 19 | #ifndef R_MATERIALIZE_DATE_H_INCLUDED 20 | #define R_MATERIALIZE_DATE_H_INCLUDED 21 | 22 | #include 23 | #include 24 | 25 | #include "materialize_common.h" 26 | #include "materialize_dbl.h" 27 | #include "nanoarrow.h" 28 | 29 | static int nanoarrow_materialize_date(struct RConverter* converter) { 30 | if (converter->ptype_view.sexp_type == REALSXP) { 31 | switch (converter->schema_view.type) { 32 | case NANOARROW_TYPE_NA: 33 | case NANOARROW_TYPE_DATE32: 34 | return nanoarrow_materialize_dbl(converter); 35 | default: 36 | break; 37 | } 38 | } 39 | 40 | return ENOTSUP; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /r/src/version.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #define R_NO_REMAP 19 | #include 20 | #include 21 | 22 | #include "nanoarrow.h" 23 | 24 | SEXP nanoarrow_c_version(void) { return Rf_mkString(NANOARROW_VERSION); } 25 | 26 | SEXP nanoarrow_c_version_runtime(void) { return Rf_mkString(ArrowNanoarrowVersion()); } 27 | 28 | SEXP nanoarrow_c_with_zstd(void) { 29 | #if defined(NANOARROW_IPC_WITH_ZSTD) 30 | return Rf_ScalarLogical(1); 31 | #else 32 | return Rf_ScalarLogical(0); 33 | #endif 34 | } 35 | -------------------------------------------------------------------------------- /r/tests/testthat.R: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | library(testthat) 19 | library(nanoarrow) 20 | 21 | verbose_test_output <- identical(tolower(Sys.getenv("ARROW_R_DEV", "false")), "true") || 22 | identical(tolower(Sys.getenv("ARROW_R_VERBOSE_TEST", "false")), "true") 23 | 24 | if (verbose_test_output) { 25 | reporter <- MultiReporter$new(list(CheckReporter$new(), LocationReporter$new())) 26 | } else { 27 | reporter <- check_reporter() 28 | } 29 | 30 | test_check("nanoarrow", reporter = reporter) 31 | -------------------------------------------------------------------------------- /r/tests/testthat/_snaps/array-stream.md: -------------------------------------------------------------------------------- 1 | # as_nanoarrow_array_stream() works for nanoarrow_array_stream 2 | 3 | is.null(schema) is not TRUE 4 | 5 | # as_nanoarrow_array_stream() works for nanoarrow_array 6 | 7 | is.null(schema) is not TRUE 8 | 9 | -------------------------------------------------------------------------------- /r/tests/testthat/_snaps/array.md: -------------------------------------------------------------------------------- 1 | # string/binary view nanoarrow_array buffers print correctly 2 | 3 | Code 4 | print(view_array_all_inlined) 5 | Output 6 | 7 | $ length : int 26 8 | $ null_count: int 0 9 | $ offset : int 0 10 | $ buffers :List of 3 11 | ..$ :[null] `` 12 | ..$ :[26][416 b]>` 13 | ..$ :[null] `` 14 | $ dictionary: NULL 15 | $ children : list() 16 | 17 | --- 18 | 19 | Code 20 | print(view_array_not_all_inlined) 21 | Output 22 | 23 | $ length : int 1 24 | $ null_count: int 0 25 | $ offset : int 0 26 | $ buffers :List of 4 27 | ..$ :[null] `` 28 | ..$ :[1][16 b]>` 29 | ..$ :[35 b]> `this string is longer...` 30 | ..$ :[1][8 b]> `35` 31 | $ dictionary: NULL 32 | $ children : list() 33 | 34 | -------------------------------------------------------------------------------- /r/tests/testthat/_snaps/as-array.md: -------------------------------------------------------------------------------- 1 | # as_nanoarrow_array() errors for bad logical() creation 2 | 3 | Invalid: Expecting a character vector 4 | 5 | # as_nanoarrow_array() errors for bad data.frame() -> na_struct() 6 | 7 | Can't create Array from object of type data.frame 8 | 9 | # as_nanoarrow_array() works for bad unspecified() create 10 | 11 | NotImplemented: day_time_interval 12 | 13 | -------------------------------------------------------------------------------- /r/tests/testthat/_snaps/buffer.md: -------------------------------------------------------------------------------- 1 | # buffer printer works for decimal buffer types 2 | 3 | Code 4 | str(dec32_array$buffers[[2]]) 5 | Output 6 | [21][84 b]> `-100 -90 -80 -70 -60 -50 -40 -...` 7 | 8 | --- 9 | 10 | Code 11 | str(dec64_array$buffers[[2]]) 12 | Output 13 | [21][168 b]> `-100 -90 -80 -70 -60 -50 -40 ...` 14 | 15 | --- 16 | 17 | Code 18 | str(dec128_array$buffers[[2]]) 19 | Output 20 | [21][336 b]> `-100 -90 -80 -70 -60 -50 -40...` 21 | 22 | --- 23 | 24 | Code 25 | str(dec256_array$buffers[[2]]) 26 | Output 27 | [21][672 b]> `-100 -90 -80 -70 -60 -50 -40...` 28 | 29 | # buffers can be printed 30 | 31 | Code 32 | str(as_nanoarrow_buffer(1:10)) 33 | Output 34 | [10][40 b]> `1 2 3 4 5 6 7 8 9 10` 35 | 36 | --- 37 | 38 | Code 39 | str(as_nanoarrow_buffer(1:10000)) 40 | Output 41 | [10000][40000 b]> `1 2 3 4 5 6 7 8 9 10 11 12 1...` 42 | 43 | --- 44 | 45 | Code 46 | str(as_nanoarrow_buffer(strrep("abcdefg", 100))) 47 | Output 48 | [700 b]> `abcdefgabcdefgabcdefgabcdefgabcdefga...` 49 | 50 | --- 51 | 52 | Code 53 | str(as_nanoarrow_buffer(charToRaw(strrep("abcdefg", 100)))) 54 | Output 55 | [700 b]> `61 62 63 64 65 66 67 61 62 63 64 65 ...` 56 | 57 | --- 58 | 59 | Code 60 | str(array$buffers[[2]]) 61 | Output 62 | > 63 | 64 | -------------------------------------------------------------------------------- /r/tests/testthat/test-nanoarrow-package.R: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | test_that("nanoarrow_version() works", { 19 | expect_identical( 20 | nanoarrow_version(runtime = TRUE), 21 | nanoarrow_version(runtime = FALSE) 22 | ) 23 | }) 24 | -------------------------------------------------------------------------------- /r/tools/test_zstd.c: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | // Function that requires at least one symbol from zstd.h 23 | size_t test_zstd(void) { 24 | uint8_t src[128]; 25 | memset(src, 0, sizeof(src)); 26 | uint8_t dst[128]; 27 | return ZSTD_compress(dst, sizeof(dst), src, sizeof(src), ZSTD_CLEVEL_DEFAULT); 28 | } 29 | -------------------------------------------------------------------------------- /src/apidoc/.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | xml 19 | -------------------------------------------------------------------------------- /src/nanoarrow/device/metal_impl.cc: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #define NS_PRIVATE_IMPLEMENTATION 19 | #define MTL_PRIVATE_IMPLEMENTATION 20 | #include "metal_impl.h" 21 | -------------------------------------------------------------------------------- /src/nanoarrow/device/metal_impl.h: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | // We have no control over the Metal headers 19 | #pragma GCC diagnostic ignored "-Wgnu-anonymous-struct" 20 | #pragma GCC diagnostic ignored "-Wnested-anon-types" 21 | #pragma GCC diagnostic ignored "-Wignored-qualifiers" 22 | #pragma GCC diagnostic push 23 | #include 24 | #pragma GCC diagnostic pop 25 | -------------------------------------------------------------------------------- /src/nanoarrow/hpp/exception_test.cc: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | 20 | #include "nanoarrow/nanoarrow.hpp" 21 | 22 | TEST(HppException, Exception) { 23 | ASSERT_THROW(NANOARROW_THROW_NOT_OK(EINVAL), nanoarrow::Exception); 24 | ASSERT_NO_THROW(NANOARROW_THROW_NOT_OK(NANOARROW_OK)); 25 | try { 26 | NANOARROW_THROW_NOT_OK(EINVAL); 27 | } catch (const nanoarrow::Exception& e) { 28 | EXPECT_EQ(std::string(e.what()).substr(0, 24), "EINVAL failed with errno"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/nanoarrow/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | conf_data = configuration_data() 19 | 20 | ns = get_option('namespace') 21 | conf_data.set('NANOARROW_NAMESPACE_DEFINE', '#define NANOARROW_NAMESPACE ' + ns) 22 | 23 | version = meson.project_version() 24 | # Remove any pre-release / build identifiers 25 | version_no_pre_release = version.split('-')[0] 26 | version_no_build = version_no_pre_release.split('+')[0] 27 | components = version_no_build.split('.') 28 | assert( 29 | components.length() >= 3, 30 | 'The version does not contain major, minor and patch', 31 | ) 32 | ver_major = components[0] 33 | ver_minor = components[1] 34 | ver_patch = components[2] 35 | conf_data.set('NANOARROW_VERSION', version) 36 | conf_data.set('NANOARROW_VERSION_MAJOR', ver_major) 37 | conf_data.set('NANOARROW_VERSION_MINOR', ver_minor) 38 | conf_data.set('NANOARROW_VERSION_PATCH', ver_patch) 39 | 40 | configure_file( 41 | input: 'nanoarrow_config.h.in', 42 | output: 'nanoarrow_config.h', 43 | configuration: conf_data, 44 | install: true, 45 | install_dir: get_option('includedir') / 'nanoarrow', 46 | ) 47 | -------------------------------------------------------------------------------- /src/nanoarrow/nanoarrow.hpp: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | /// \defgroup nanoarrow_hpp Nanoarrow C++ Helpers 19 | /// 20 | /// The utilities provided in this file are intended to support C++ users 21 | /// of the nanoarrow C library such that C++-style resource allocation 22 | /// and error handling can be used with nanoarrow data structures. 23 | /// These utilities are not intended to mirror the nanoarrow C API. 24 | 25 | #include "nanoarrow/hpp/array_stream.hpp" 26 | #include "nanoarrow/hpp/buffer.hpp" 27 | #include "nanoarrow/hpp/exception.hpp" 28 | #include "nanoarrow/hpp/operators.hpp" 29 | #include "nanoarrow/hpp/unique.hpp" 30 | #include "nanoarrow/hpp/view.hpp" 31 | -------------------------------------------------------------------------------- /src/nanoarrow/nanoarrow_config.h.in: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #ifndef NANOARROW_CONFIG_H_INCLUDED 19 | #define NANOARROW_CONFIG_H_INCLUDED 20 | 21 | #define NANOARROW_VERSION_MAJOR @NANOARROW_VERSION_MAJOR@ 22 | #define NANOARROW_VERSION_MINOR @NANOARROW_VERSION_MINOR@ 23 | #define NANOARROW_VERSION_PATCH @NANOARROW_VERSION_PATCH@ 24 | #define NANOARROW_VERSION "@NANOARROW_VERSION@" 25 | 26 | #define NANOARROW_VERSION_INT \ 27 | (NANOARROW_VERSION_MAJOR * 10000 + NANOARROW_VERSION_MINOR * 100 + \ 28 | NANOARROW_VERSION_PATCH) 29 | 30 | @NANOARROW_NAMESPACE_DEFINE@ 31 | 32 | #if !defined(NANOARROW_CXX_NAMESPACE) 33 | #define NANOARROW_CXX_NAMESPACE nanoarrow 34 | #endif 35 | 36 | #define NANOARROW_CXX_NAMESPACE_BEGIN namespace NANOARROW_CXX_NAMESPACE { 37 | #define NANOARROW_CXX_NAMESPACE_END } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/nanoarrow/nanoarrow_gtest_util.hpp: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | #include 19 | #include 20 | 21 | #include "nanoarrow/nanoarrow.hpp" 22 | 23 | #ifndef NANOARROW_GTEST_UTIL_HPP_INCLUDED 24 | #define NANOARROW_GTEST_UTIL_HPP_INCLUDED 25 | 26 | /// \defgroup nanoarrow_testing Nanoarrow Testing Helpers 27 | /// 28 | /// Utilities for testing nanoarrow structures and functions. 29 | 30 | namespace nanoarrow { 31 | namespace internal { 32 | 33 | inline void PrintTo(const Nothing&, std::ostream* os) { *os << ""; } 34 | 35 | template 36 | void PrintTo(const Maybe& m, std::ostream* os) { 37 | if (m) { 38 | *os << ::testing::PrintToString(*m); 39 | } else { 40 | PrintTo(NA, os); 41 | } 42 | } 43 | 44 | } // namespace internal 45 | } // namespace nanoarrow 46 | 47 | inline void PrintTo(const ArrowStringView& sv, std::ostream* os) { 48 | *os << "'"; 49 | os->write(sv.data, static_cast(sv.size_bytes)); 50 | *os << "'"; 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /subprojects/flatcc.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = flatcc-fd3c4ae5cd39f0651eda6a3a1a374278070135d6 20 | source_url = https://github.com/dvidelabs/flatcc/archive/fd3c4ae5cd39f0651eda6a3a1a374278070135d6.tar.gz 21 | source_filename = flatcc-fd3c4ae5cd39f0651eda6a3a1a374278070135d6.tar.gz 22 | source_hash = 353cb04a619865383b87c8077eb39b63b01a3fc44f7bebd558a88f139c6b6f77 23 | patch_directory = flatcc 24 | 25 | [provide] 26 | flatcc = flatcc_dep 27 | -------------------------------------------------------------------------------- /subprojects/google-benchmark.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = benchmark-1.8.4 20 | source_url = https://github.com/google/benchmark/archive/refs/tags/v1.8.4.tar.gz 21 | source_filename = benchmark-1.8.4.tar.gz 22 | source_hash = 3e7059b6b11fb1bbe28e33e02519398ca94c1818874ebed18e504dc6f709be45 23 | patch_filename = google-benchmark_1.8.4-1_patch.zip 24 | patch_url = https://wrapdb.mesonbuild.com/v2/google-benchmark_1.8.4-1/get_patch 25 | patch_hash = 77cdae534fe12b6783c1267de3673d3462b229054519034710d581b419e73cca 26 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/google-benchmark_1.8.4-1/benchmark-1.8.4.tar.gz 27 | wrapdb_version = 1.8.4-1 28 | 29 | [provide] 30 | benchmark = google_benchmark_dep 31 | benchmark-main = google_benchmark_main_dep 32 | -------------------------------------------------------------------------------- /subprojects/gtest.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = googletest-1.14.0 20 | source_url = https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz 21 | source_filename = gtest-1.14.0.tar.gz 22 | source_hash = 8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7 23 | patch_filename = gtest_1.14.0-2_patch.zip 24 | patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-2/get_patch 25 | patch_hash = 4ec7f767364386a99f7b2d61678287a73ad6ba0f9998be43b51794c464a63732 26 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.14.0-2/gtest-1.14.0.tar.gz 27 | wrapdb_version = 1.14.0-2 28 | 29 | [provide] 30 | gtest = gtest_dep 31 | gtest_main = gtest_main_dep 32 | gmock = gmock_dep 33 | gmock_main = gmock_main_dep 34 | -------------------------------------------------------------------------------- /subprojects/metal-cpp.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = metal-cpp 20 | source_url = https://developer.apple.com/metal/cpp/files/metal-cpp_macOS12_iOS15.zip 21 | source_filename = metal-cpp_macOS12_iOS15.zip 22 | source_hash = a4e2d4668951b6f2595618ed8c5dc514fc94fda5487fc722b1c1ff29d7b524f7 23 | patch_directory = metal-cpp 24 | 25 | [provide] 26 | metal-cpp = metal_cpp_dep 27 | -------------------------------------------------------------------------------- /subprojects/nlohmann_json.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = nlohmann_json-3.11.2 20 | lead_directory_missing = true 21 | source_url = https://github.com/nlohmann/json/releases/download/v3.11.2/include.zip 22 | source_filename = nlohmann_json-3.11.2.zip 23 | source_hash = e5c7a9f49a16814be27e4ed0ee900ecd0092bfb7dbfca65b5a421b774dccaaed 24 | wrapdb_version = 3.11.2-1 25 | 26 | [provide] 27 | nlohmann_json = nlohmann_json_dep 28 | -------------------------------------------------------------------------------- /subprojects/packagefiles/flatcc/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project('flatcc', 'c', version: '0.6.1', license: 'Apache-2.0') 19 | 20 | incdir = include_directories('include') 21 | 22 | flatcc_lib = library( 23 | 'flatcc', 24 | sources: [ 25 | 'src/runtime/builder.c', 26 | 'src/runtime/emitter.c', 27 | 'src/runtime/verifier.c', 28 | 'src/runtime/refmap.c', 29 | ], 30 | include_directories: [incdir], 31 | ) 32 | 33 | flatcc_dep = declare_dependency( 34 | include_directories: [incdir], 35 | link_with: [flatcc_lib], 36 | ) 37 | -------------------------------------------------------------------------------- /subprojects/packagefiles/metal-cpp/meson.build: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | project('metal-cpp', 'cpp', license: 'Apache-2.0') 19 | 20 | incdir = include_directories('.') 21 | metal_cpp_dep = declare_dependency(include_directories: incdir) 22 | -------------------------------------------------------------------------------- /subprojects/zlib.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = zlib-1.3.1 20 | source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz 21 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz 22 | source_filename = zlib-1.3.1.tar.gz 23 | source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 24 | patch_filename = zlib_1.3.1-1_patch.zip 25 | patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch 26 | patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095 27 | wrapdb_version = 1.3.1-1 28 | 29 | [provide] 30 | zlib = zlib_dep 31 | -------------------------------------------------------------------------------- /subprojects/zstd.wrap: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [wrap-file] 19 | directory = zstd-1.5.6 20 | source_url = https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz 21 | source_filename = zstd-1.5.6.tar.gz 22 | source_hash = 8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 23 | patch_filename = zstd_1.5.6-2_patch.zip 24 | patch_url = https://wrapdb.mesonbuild.com/v2/zstd_1.5.6-2/get_patch 25 | patch_hash = 3e67f7d2edf3c56e6450d4c0f5f3d5fe94799e3608e3795502da03f7dd51b28c 26 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zstd_1.5.6-2/zstd-1.5.6.tar.gz 27 | wrapdb_version = 1.5.6-2 28 | 29 | [provide] 30 | libzstd = libzstd_dep 31 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_assert.h: -------------------------------------------------------------------------------- 1 | #ifndef FLATCC_ASSERT_H 2 | #define FLATCC_ASSERT_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | * This assert abstraction is only used for the flatcc runtime library. 10 | * The flatcc compiler uses Posix assert routines regardless of how this 11 | * file is configured. 12 | * 13 | * This header makes it possible to use systems where assert is not 14 | * valid to use. Note that `` may remain a dependency for static 15 | * assertions. 16 | * 17 | * `FLATCC_ASSERT` is designed to handle errors which cannot be ignored 18 | * and could lead to crash. The portable library may use assertions that 19 | * are not affected by this macro. 20 | * 21 | * `FLATCC_ASSERT` defaults to POSIX assert but can be overrided by a 22 | * preprocessor definition. 23 | * 24 | * Runtime assertions can be entirely disabled by defining 25 | * `FLATCC_NO_ASSERT`. 26 | */ 27 | 28 | #ifdef FLATCC_NO_ASSERT 29 | /* NOTE: This will not affect inclusion of for static assertions. */ 30 | #undef FLATCC_ASSERT 31 | #define FLATCC_ASSERT(x) ((void)0) 32 | /* Grisu3 is used for floating point conversion in JSON processing. */ 33 | #define GRISU3_NO_ASSERT 34 | #endif 35 | 36 | #ifndef FLATCC_ASSERT 37 | #include 38 | #define FLATCC_ASSERT assert 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* FLATCC_ASSERT_H */ 46 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_epilogue.h: -------------------------------------------------------------------------------- 1 | /* Include guard intentionally left out. */ 2 | 3 | #ifdef __cplusplus 4 | } 5 | #endif 6 | 7 | #include "flatcc/portable/pdiagnostic_pop.h" 8 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_flatbuffers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Even C11 compilers depend on clib support for `static_assert` which 3 | * isn't always present, so we deal with this here for all compilers. 4 | * 5 | * Outside include guard to handle scope counter. 6 | */ 7 | #include "flatcc/portable/pstatic_assert.h" 8 | 9 | #ifndef FLATCC_FLATBUFFERS_H 10 | #define FLATCC_FLATBUFFERS_H 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef flatcc_flatbuffers_defined 17 | #define flatcc_flatbuffers_defined 18 | 19 | #ifdef FLATCC_PORTABLE 20 | #include "flatcc/flatcc_portable.h" 21 | #endif 22 | #include "flatcc/portable/pwarnings.h" 23 | /* Needed by C99 compilers without FLATCC_PORTABLE. */ 24 | #include "flatcc/portable/pstdalign.h" 25 | 26 | /* Handle fallthrough attribute in switch statements. */ 27 | #include "flatcc/portable/pattributes.h" 28 | 29 | #include "flatcc/flatcc_alloc.h" 30 | #include "flatcc/flatcc_assert.h" 31 | 32 | #define __FLATBUFFERS_PASTE2(a, b) a ## b 33 | #define __FLATBUFFERS_PASTE3(a, b, c) a ## b ## c 34 | #define __FLATBUFFERS_CONCAT(a, b) __FLATBUFFERS_PASTE2(a, b) 35 | 36 | /* 37 | * "flatcc_endian.h" requires the preceeding include files, 38 | * or compatible definitions. 39 | */ 40 | #include "flatcc/portable/pendian.h" 41 | /* Needed by flatcc_accessors.h to handle strict aliasing rules. */ 42 | #include "flatcc/portable/pmemaccess.h" 43 | #include "flatcc/flatcc_types.h" 44 | #include "flatcc/flatcc_endian.h" 45 | #include "flatcc/flatcc_identifier.h" 46 | 47 | #ifndef FLATBUFFERS_WRAP_NAMESPACE 48 | #define FLATBUFFERS_WRAP_NAMESPACE(ns, x) ns ## _ ## x 49 | #endif 50 | 51 | #endif /* flatcc_flatbuffers_defined */ 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* FLATCC_FLATBUFFERS_H */ 58 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_iov.h: -------------------------------------------------------------------------------- 1 | #ifndef FLATCC_IOV_H 2 | #define FLATCC_IOV_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | /* 11 | * The emitter receives one, or a few buffers at a time via 12 | * this type. compatible iovec structure used for 13 | * allocation and emitter interface. 14 | */ 15 | typedef struct flatcc_iovec flatcc_iovec_t; 16 | struct flatcc_iovec { 17 | void *iov_base; 18 | size_t iov_len; 19 | }; 20 | 21 | /* 22 | * The largest iovec vector the builder will issue. It will 23 | * always be a relatively small number. 24 | */ 25 | #define FLATCC_IOV_COUNT_MAX 8 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /* FLATCC_IOV_H */ 32 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_portable.h: -------------------------------------------------------------------------------- 1 | #ifndef FLATCC_PORTABLE_H 2 | #define FLATCC_PORTABLE_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "flatcc/portable/portable_basic.h" 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif /* FLATCC_PORTABLE_H */ 15 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/flatcc_prologue.h: -------------------------------------------------------------------------------- 1 | /* Include guard intentionally left out. */ 2 | 3 | #define PDIAGNOSTIC_IGNORE_UNUSED 4 | #include "flatcc/portable/pdiagnostic_push.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pdiagnostic_pop.h: -------------------------------------------------------------------------------- 1 | #if defined(PDIAGNOSTIC_PUSHED_MSVC) 2 | #if PDIAGNOSTIC_PUSHED_MSVC 3 | #pragma warning( pop ) 4 | #endif // PDIAGNOSTIC_PUSHED_MSVC 5 | #undef PDIAGNOSTIC_PUSHED_MSVC 6 | #endif // defined(PDIAGNOSTIC_PUSHED_MSVC) 7 | 8 | #if defined(PDIAGNOSTIC_PUSHED_CLANG) 9 | #if PDIAGNOSTIC_PUSHED_CLANG 10 | #pragma clang diagnostic pop 11 | #endif // PDIAGNOSTIC_PUSHED_CLANG 12 | #undef PDIAGNOSTIC_PUSHED_CLANG 13 | #endif // defined(PDIAGNOSTIC_PUSHED_CLANG) 14 | 15 | #if defined(PDIAGNOSTIC_PUSHED_GCC) 16 | #if PDIAGNOSTIC_PUSHED_GCC 17 | #pragma GCC diagnostic pop 18 | #endif // PDIAGNOSTIC_PUSHED_GCC 19 | #undef PDIAGNOSTIC_PUSHED_GCC 20 | #endif // defined(PDIAGNOSTIC_PUSHED_GCC) 21 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pdiagnostic_push.h: -------------------------------------------------------------------------------- 1 | /* 2 | * See also comment in "pdiagnostic.h" 3 | * 4 | * e.g. 5 | * #define PDIAGNOSTIC_IGNORE_USED_FUNCTION 6 | * #define PDIAGNOSTIC_IGNORE_USED_VARIABLE 7 | * #include "pdiagnostic_push" 8 | * ... 9 | * #include "pdiagnostic_pop.h" 10 | * 11 | * 12 | * or if push pop isn't desired: 13 | * #define PDIAGNOSTIC_IGNORE_USED_FUNCTION 14 | * #define PDIAGNOSTIC_IGNORE_USED_VARIABLE 15 | * #include "pdiagnostic.h" 16 | * ... 17 | * 18 | * 19 | * 20 | * Some if these warnings cannot be ignored 21 | * at the #pragma level, but might in the future. 22 | * Use compiler switches like -Wno-unused-function 23 | * to work around this. 24 | */ 25 | 26 | #if defined(_MSC_VER) 27 | #pragma warning( push ) 28 | #define PDIAGNOSTIC_PUSHED_MSVC 1 29 | #else 30 | #define PDIAGNOSTIC_PUSHED_MSVC 0 31 | #endif 32 | 33 | #if defined(__clang__) 34 | #pragma clang diagnostic push 35 | #define PDIAGNOSTIC_PUSHED_CLANG 1 36 | #else 37 | #define PDIAGNOSTIC_PUSHED_CLANG 0 38 | #endif 39 | 40 | #if defined(__GNUC__) && !defined(__clang__) 41 | #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 42 | #pragma GCC diagnostic push 43 | #define PDIAGNOSTIC_PUSHED_GCC 1 44 | #else 45 | #define PDIAGNOSTIC_PUSHED_GCC 0 46 | #endif // GNUC >= 4.6 47 | #else 48 | #define PDIAGNOSTIC_PUSHED_GCC 0 49 | #endif // defined(__GNUC__) && !defined(__clang__) 50 | 51 | #include "pdiagnostic.h" 52 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pinline.h: -------------------------------------------------------------------------------- 1 | #ifndef PINLINE_H 2 | #define PINLINE_H 3 | 4 | #ifndef __cplusplus 5 | 6 | #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 7 | /* C99 or newer */ 8 | #elif _MSC_VER >= 1500 /* MSVC 9 or newer */ 9 | #undef inline 10 | #define inline __inline 11 | #elif __GNUC__ >= 3 /* GCC 3 or newer */ 12 | #define inline __inline 13 | #else /* Unknown or ancient */ 14 | #define inline 15 | #endif 16 | 17 | #endif /* __cplusplus */ 18 | 19 | #endif /* PINLINE_H */ 20 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pinttypes.h: -------------------------------------------------------------------------------- 1 | #ifndef PINTTYPES_H 2 | #define PINTTYPES_H 3 | 4 | #ifndef PRId16 5 | 6 | #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 7 | /* C99 or newer */ 8 | #include 9 | #else 10 | 11 | /* 12 | * This is not a complete implementation of , just the most 13 | * useful printf modifiers. 14 | */ 15 | 16 | #include "pstdint.h" 17 | 18 | #ifndef PRINTF_INT64_MODIFIER 19 | #error "please define PRINTF_INT64_MODIFIER" 20 | #endif 21 | 22 | #ifndef PRId64 23 | #define PRId64 PRINTF_INT64_MODIFIER "d" 24 | #define PRIu64 PRINTF_INT64_MODIFIER "u" 25 | #define PRIx64 PRINTF_INT64_MODIFIER "x" 26 | #endif 27 | 28 | #ifndef PRINTF_INT32_MODIFIER 29 | #define PRINTF_INT32_MODIFIER "l" 30 | #endif 31 | 32 | #ifndef PRId32 33 | #define PRId32 PRINTF_INT32_MODIFIER "d" 34 | #define PRIu32 PRINTF_INT32_MODIFIER "u" 35 | #define PRIx32 PRINTF_INT32_MODIFIER "x" 36 | #endif 37 | 38 | #ifndef PRINTF_INT16_MODIFIER 39 | #define PRINTF_INT16_MODIFIER "h" 40 | #endif 41 | 42 | #ifndef PRId16 43 | #define PRId16 PRINTF_INT16_MODIFIER "d" 44 | #define PRIu16 PRINTF_INT16_MODIFIER "u" 45 | #define PRIx16 PRINTF_INT16_MODIFIER "x" 46 | #endif 47 | 48 | # endif /* __STDC__ */ 49 | 50 | #endif /* PRId16 */ 51 | 52 | #endif /* PINTTYPES */ 53 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/portable.h: -------------------------------------------------------------------------------- 1 | /* portable.h is widely used, so we redirect to a less conflicting name. */ 2 | #include "portable_basic.h" 3 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/portable_basic.h: -------------------------------------------------------------------------------- 1 | #ifndef PORTABLE_BASIC_H 2 | #define PORTABLE_BASIC_H 3 | 4 | /* 5 | * Basic features need to make compilers support the most common moden C 6 | * features, and endian / unligned read support as well. 7 | * 8 | * It is not assumed that this file is always included. 9 | * Other include files are independent or include what they need. 10 | */ 11 | 12 | #include "pversion.h" 13 | #include "pwarnings.h" 14 | 15 | /* Featutures that ought to be supported by C11, but some aren't. */ 16 | #include "pinttypes.h" 17 | #include "pstdalign.h" 18 | #include "pinline.h" 19 | #include "pstatic_assert.h" 20 | 21 | /* These are not supported by C11 and are general platform abstractions. */ 22 | #include "pendian.h" 23 | #include "punaligned.h" 24 | #include "pmemaccess.h" 25 | 26 | 27 | #endif /* PORTABLE_BASIC_H */ 28 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/prestrict.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2024 Mikkel Fahnøe Jørgensen, dvide.com 4 | * 5 | * (MIT License) 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | * this software and associated documentation files (the "Software"), to deal in 8 | * the Software without restriction, including without limitation the rights to 9 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | * the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * - The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * - The Software is provided "as is", without warranty of any kind, express or 15 | * implied, including but not limited to the warranties of merchantability, 16 | * fitness for a particular purpose and noninfringement. In no event shall the 17 | * authors or copyright holders be liable for any claim, damages or other 18 | * liability, whether in an action of contract, tort or otherwise, arising from, 19 | * out of or in connection with the Software or the use or other dealings in the 20 | * Software. 21 | */ 22 | 23 | #ifndef PRESTRICT_H 24 | #define PRESTRICT_H 25 | 26 | 27 | #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 28 | /* C99 or newer */ 29 | #elif defined(__restrict) 30 | /* Some C/C++ compilers use alternative syntax. If these are defines, we can detect them. */ 31 | #define restrict __restrict 32 | #elif defined(__restrict__) 33 | #define restrict __restrict__ 34 | #else 35 | #define restrict 36 | #endif 37 | 38 | 39 | #endif /* PRESTRICT_H */ 40 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pversion.h: -------------------------------------------------------------------------------- 1 | #define PORTABLE_VERSION_TEXT "0.2.6-pre" 2 | #define PORTABLE_VERSION_MAJOR 0 3 | #define PORTABLE_VERSION_MINOR 2 4 | #define PORTABLE_VERSION_PATCH 6 5 | /* 1 or 0 */ 6 | #define PORTABLE_VERSION_RELEASED 0 7 | -------------------------------------------------------------------------------- /thirdparty/flatcc/include/flatcc/portable/pwarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef PWARNINGS_H 2 | #define PWARNINGS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | * See also pdiagnostics.h headers for per file control of common 10 | * warnings. 11 | * 12 | * This file is intended for global disabling of warnings that shouldn't 13 | * be present in C11 or perhaps C99, or a generally just noise where 14 | * recent clang / gcc compile cleanly with high warning levels. 15 | */ 16 | 17 | #if defined(_MSC_VER) 18 | /* Needed when flagging code in or out and more. */ 19 | #pragma warning(disable: 4127) /* conditional expression is constant */ 20 | /* happens also in MS's own headers. */ 21 | #pragma warning(disable: 4668) /* preprocessor name not defined */ 22 | /* MSVC does not respect double parenthesis for intent */ 23 | #pragma warning(disable: 4706) /* assignment within conditional expression */ 24 | /* `inline` only advisory anyway. */ 25 | #pragma warning(disable: 4710) /* function not inlined */ 26 | /* Well, we don't intend to add the padding manually. */ 27 | #pragma warning(disable: 4820) /* x bytes padding added in struct */ 28 | 29 | /* 30 | * Don't warn that fopen etc. are unsafe 31 | * 32 | * Define a compiler flag like `-D_CRT_SECURE_NO_WARNINGS` in the build. 33 | * For some reason it doesn't work when defined here. 34 | * 35 | * #define _CRT_SECURE_NO_WARNINGS 36 | */ 37 | 38 | /* 39 | * Anonymous union in struct is valid in C11 and has been supported in 40 | * GCC and Clang for a while, but it is not C99. MSVC also handles it, 41 | * but warns. Truly portable code should perhaps not use this feature, 42 | * but this is not the place to complain about it. 43 | */ 44 | #pragma warning(disable: 4201) /* nonstandard extension used: nameless struct/union */ 45 | 46 | #endif /* _MSV_VER */ 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* PWARNINGS_H */ 53 | -------------------------------------------------------------------------------- /thirdparty/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | include(FetchContent) 19 | 20 | # Use an old version of googletest if we have to to support gcc 4.8 21 | if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION 22 | VERSION_GREATER_EQUAL "5.0.0") 23 | fetchcontent_declare(googletest 24 | URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz 25 | URL_HASH SHA256=8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7 26 | ) 27 | else() 28 | fetchcontent_declare(googletest 29 | URL https://github.com/google/googletest/archive/release-1.10.0.zip 30 | URL_HASH SHA256=94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91 31 | ) 32 | endif() 33 | 34 | fetchcontent_makeavailable(googletest) 35 | -------------------------------------------------------------------------------- /thirdparty/nlohmann_json/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | include(FetchContent) 19 | 20 | fetchcontent_declare(nlohmann_json 21 | URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.zip 22 | URL_HASH SHA256=04022b05d806eb5ff73023c280b68697d12b93e1b7267a0b22a1a39ec7578069 23 | ) 24 | fetchcontent_makeavailable(nlohmann_json) 25 | -------------------------------------------------------------------------------- /thirdparty/zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | fetchcontent_declare(nanoarrow_zlib 19 | URL https://github.com/madler/zlib/releases/download/v1.3/zlib13.zip 20 | URL_HASH SHA256=c561d09347f674f0d72692e7c75d9898919326c532aab7f8c07bb43b07efeb38 21 | ) 22 | fetchcontent_makeavailable(nanoarrow_zlib) 23 | 24 | add_library(ZLIB::ZLIB ALIAS zlibstatic) 25 | target_include_directories(zlibstatic INTERFACE ${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) 26 | target_include_directories(zlib INTERFACE ${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) 27 | -------------------------------------------------------------------------------- /valgrind.supp: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | { 19 | :Thread locals don't appear to be freed 20 | Memcheck:Leak 21 | ... 22 | fun:_dl_allocate_tls 23 | } 24 | 25 | { 26 | :Thread locals don't appear to be freed 27 | Memcheck:Leak 28 | ... 29 | fun:__tls_get_addr 30 | } 31 | 32 | { 33 | :Handle PyMalloc confusing valgrind (possibly leaked) 34 | Memcheck:Leak 35 | fun:malloc 36 | ... 37 | fun:_PyObject_GC_Resize 38 | } 39 | 40 | { 41 | :Handle PyMalloc confusing valgrind (possibly leaked) 42 | Memcheck:Leak 43 | fun:realloc 44 | fun:_PyObject_GC_Resize 45 | } 46 | 47 | { 48 | :Handle PyMalloc confusing valgrind (possibly leaked) 49 | Memcheck:Leak 50 | fun:malloc 51 | fun:_PyObject_GC_New 52 | } 53 | 54 | { 55 | :Handle PyMalloc confusing valgrind (possibly leaked) 56 | Memcheck:Leak 57 | fun:malloc 58 | fun:_PyObject_GC_NewVar 59 | } 60 | --------------------------------------------------------------------------------