├── .editorconfig ├── .github ├── dependabot.yml └── workflows │ ├── ci.yaml │ ├── doc.yaml │ └── package.yaml ├── .gitignore ├── .gitmodules ├── .prettierignore ├── Brewfile ├── Cargo.toml ├── Gemfile ├── LICENSE ├── README.md ├── build.py ├── cbindgen.toml ├── cpp └── CMakeLists.txt ├── datafusion-config.cmake.in ├── datafusion-glib-config.cmake.in ├── datafusion-glib ├── .gitignore ├── csv-read-options-raw.h ├── csv-read-options.c ├── csv-read-options.h ├── data-frame-raw.h ├── data-frame.c ├── data-frame.h ├── datafusion-glib-raw.h ├── datafusion-glib.h ├── error.c ├── error.h ├── meson.build ├── parquet-read-options-raw.h ├── parquet-read-options.c ├── parquet-read-options.h ├── session-context-raw.h ├── session-context.c ├── session-context.h └── version.h.in ├── dev └── release │ ├── README.md │ ├── prepare.sh │ ├── rat_exclude_files.txt │ ├── tag.sh │ └── verify-packages.sh ├── doc ├── Doxyfile.in ├── Makefile ├── build.py ├── glib │ ├── datafusion-glib-docs.xml │ ├── entities.xml.in │ ├── gi-docgen.toml.in │ └── meson.build ├── meson.build └── source │ ├── _static │ └── switcher.json │ ├── conf.py │ ├── developer.rst │ ├── developer │ └── release.rst │ ├── example │ └── sql.rst │ ├── glib-api.rst │ ├── index.rst │ ├── install.rst │ ├── introduction.rst │ ├── news.rst │ ├── news │ ├── 10.0.0.md │ └── 21.0.0.md │ └── raw-c-api.rst ├── example ├── meson.build ├── sql-glib.c ├── sql-glib.py ├── sql-glib.rb ├── sql-glib.vala ├── sql.c ├── sql.py └── sql.rb ├── meson.build ├── meson_options.txt ├── package ├── Rakefile ├── apt │ ├── build.sh │ ├── debian-bookworm-arm64 │ │ └── from │ ├── debian-bookworm │ │ └── Dockerfile │ ├── debian-bullseye-arm64 │ │ └── from │ ├── debian-bullseye │ │ └── Dockerfile │ ├── test.sh │ ├── ubuntu-focal-arm64 │ │ └── from │ ├── ubuntu-focal │ │ └── Dockerfile │ ├── ubuntu-jammy-arm64 │ │ └── from │ └── ubuntu-jammy │ │ └── Dockerfile ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── gir1.2-datafusion-21.0.install │ ├── libdatafusion-dev.install │ ├── libdatafusion-glib-dev.install │ ├── libdatafusion-glib-doc.doc-base │ ├── libdatafusion-glib-doc.install │ ├── libdatafusion-glib-doc.links │ ├── libdatafusion-glib21.install │ ├── libdatafusion21.install │ └── rules └── yum │ ├── almalinux-8-aarch64 │ └── from │ ├── almalinux-8 │ └── Dockerfile │ ├── almalinux-9-aarch64 │ └── from │ ├── almalinux-9 │ └── Dockerfile │ ├── datafusion-c.spec.in │ └── test.sh ├── requirements.txt ├── rustfmt.toml ├── src ├── capi.rs └── lib.rs └── test ├── helper.rb ├── run.rb ├── run.sh ├── test-csv-read-options.rb ├── test-data-frame.rb ├── test-error.rb ├── test-parquet-read-options.rb └── test-session-context.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | root = true 16 | 17 | [{meson.build,meson_options.txt,*.sh}] 18 | indent_style = space 19 | indent_size = 2 20 | end_of_line = lf 21 | insert_final_newline = true 22 | trim_trailing_whitespace = true 23 | 24 | [*.{vala,rs}] 25 | indent_style = space 26 | end_of_line = lf 27 | insert_final_newline = true 28 | trim_trailing_whitespace = true 29 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: 2 16 | updates: 17 | - package-ecosystem: "github-actions" 18 | directory: "/" 19 | schedule: 20 | interval: "weekly" 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2024 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: CI 16 | 17 | on: 18 | - push 19 | - pull_request 20 | 21 | concurrency: 22 | group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | rat: 27 | name: Release Audit Tool (RAT) 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v4 31 | with: 32 | path: datafusion-c 33 | - name: Checkout Arrow 34 | uses: actions/checkout@v4 35 | with: 36 | path: arrow 37 | repository: apache/arrow 38 | - uses: actions/setup-python@v5 39 | with: 40 | python-version: "3.x" 41 | - name: Setup Archery 42 | run: | 43 | pip install -e arrow/dev/archery[lint] 44 | - name: Run RAT 45 | run: | 46 | cd datafusion-c && archery lint --rat 47 | 48 | lint: 49 | name: Lint 50 | runs-on: ubuntu-latest 51 | steps: 52 | - uses: actions/checkout@v4 53 | - uses: actions-rs/toolchain@v1 54 | id: rust-toolchain 55 | with: 56 | components: rustfmt, clippy 57 | override: true 58 | toolchain: stable 59 | - name: Cache Cargo 60 | uses: actions/cache@v4 61 | with: 62 | path: ~/.cargo 63 | key: cargo-lint-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }} 64 | - name: Check format 65 | uses: actions-rs/cargo@v1 66 | with: 67 | command: fmt 68 | args: --all -- --check 69 | - name: Run Clippy 70 | uses: actions-rs/cargo@v1 71 | with: 72 | command: clippy 73 | args: --all-targets --all-features -- -D clippy::all -D warnings 74 | - uses: actions/setup-node@v4 75 | with: 76 | node-version: "lts/*" 77 | - name: Prettier 78 | run: | 79 | npx prettier --check "**.md" 80 | 81 | test: 82 | name: Test 83 | strategy: 84 | fail-fast: false 85 | matrix: 86 | runs-on: 87 | - ubuntu-latest 88 | - macos-latest 89 | - windows-latest 90 | runs-on: ${{ matrix.runs-on }} 91 | steps: 92 | - uses: actions/checkout@v4 93 | - uses: actions/setup-python@v5 94 | if: | 95 | matrix.runs-on != 'windows-latest' 96 | with: 97 | python-version: '3.x' 98 | - name: Prepare on Ubuntu 99 | if: | 100 | matrix.runs-on == 'ubuntu-latest' 101 | run: | 102 | sudo apt update 103 | sudo apt install -y -V \ 104 | ca-certificates \ 105 | lsb-release \ 106 | wget 107 | wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 108 | sudo apt install -y -V \ 109 | ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 110 | sudo apt update 111 | sudo apt install -y -V \ 112 | libarrow-glib-dev \ 113 | libgirepository1.0-dev \ 114 | libparquet-glib-dev \ 115 | ninja-build \ 116 | valac 117 | pip install meson 118 | echo "GI_TYPELIB_PATH=${HOME}/local/lib/girepository-1.0" >> ${GITHUB_ENV} 119 | echo "LD_LIBRARY_PATH=${PWD}/build:${HOME}/local/lib:${LD_LIBRARY_PATH}" >> ${GITHUB_ENV} 120 | - name: Prepare on macOS 121 | if: | 122 | matrix.runs-on == 'macos-latest' 123 | run: | 124 | brew bundle --file=Brewfile 125 | echo "DYLD_LIBRARY_PATH=${PWD}/build:${HOME}/local/lib:${DYLD_LIBRARY_PATH}" >> ${GITHUB_ENV} 126 | echo "GI_TYPELIB_PATH=${HOME}/local/lib/girepository-1.0" >> ${GITHUB_ENV} 127 | echo "XML_CATALOG_FILES=$(brew --prefix)/etc/xml/catalog" >> ${GITHUB_ENV} 128 | # - name: Prepare on Windows 129 | # if: | 130 | # matrix.runs-on == 'windows-latest' 131 | # run: | 132 | # pip install meson 133 | - uses: ruby/setup-ruby@v1 134 | if: | 135 | matrix.runs-on != 'windows-latest' 136 | with: 137 | ruby-version: "3.1" 138 | bundler-cache: true 139 | - uses: actions-rs/toolchain@v1 140 | id: rust-toolchain 141 | with: 142 | override: true 143 | toolchain: stable 144 | - name: Cache Cargo 145 | uses: actions/cache@v4 146 | with: 147 | path: ~/.cargo 148 | key: cargo-test-${{ matrix.runs-on }}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }} 149 | - name: Install cargo-c 150 | uses: actions-rs/cargo@v1 151 | with: 152 | command: install 153 | args: cargo-c 154 | - name: Setup on non-Windows 155 | if: | 156 | matrix.runs-on != 'windows-latest' 157 | run: | 158 | meson setup \ 159 | --libdir=lib \ 160 | --prefix=${HOME}/local \ 161 | -Dvapi=${{ matrix.runs-on == 'ubuntu-latest' }} \ 162 | -Dwerror=true \ 163 | build \ 164 | . 165 | - name: Build on non-Windows 166 | if: | 167 | matrix.runs-on != 'windows-latest' 168 | run: | 169 | ninja -C build 170 | - name: Build on Windows 171 | if: | 172 | matrix.runs-on == 'windows-latest' 173 | uses: actions-rs/cargo@v1 174 | with: 175 | command: cbuild 176 | - name: Test 177 | if: | 178 | matrix.runs-on != 'windows-latest' 179 | run: | 180 | cd build 181 | bundle exec ../test/run.sh 182 | - name: Install 183 | if: | 184 | matrix.runs-on != 'windows-latest' 185 | run: | 186 | ninja -C build install 187 | - name: Run C example 188 | if: | 189 | matrix.runs-on != 'windows-latest' 190 | run: | 191 | build/example/sql-c 192 | - name: Run Python example 193 | if: | 194 | matrix.runs-on != 'windows-latest' 195 | run: | 196 | cd build 197 | ../example/sql.py 198 | - name: Run Ruby example 199 | if: | 200 | matrix.runs-on != 'windows-latest' 201 | run: | 202 | cd build 203 | ../example/sql.rb 204 | - name: Run GLib C example 205 | if: | 206 | matrix.runs-on != 'windows-latest' 207 | run: | 208 | build/example/sql-glib-c 209 | - name: Run GLib Vala example 210 | if: | 211 | matrix.runs-on == 'ubuntu-latest' 212 | run: | 213 | build/example/sql-glib-vala 214 | - name: Run GLib Python example 215 | if: | 216 | matrix.runs-on == 'ubuntu-latest' 217 | run: | 218 | pip install PyGObject 219 | example/sql-glib.py 220 | - name: Run GLib Ruby example 221 | if: | 222 | matrix.runs-on == 'ubuntu-latest' 223 | run: | 224 | bundle exec example/sql-glib.rb 225 | -------------------------------------------------------------------------------- /.github/workflows/doc.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Document 16 | 17 | on: 18 | - push 19 | - pull_request 20 | 21 | jobs: 22 | build: 23 | name: Build 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v4 27 | - uses: actions/setup-python@v5 28 | with: 29 | python-version: '3.x' 30 | - name: Prepare 31 | run: | 32 | sudo apt update 33 | sudo apt install -y -V \ 34 | ca-certificates \ 35 | lsb-release \ 36 | wget 37 | wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 38 | sudo apt install -y -V \ 39 | ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 40 | sudo apt update 41 | sudo apt install -y -V \ 42 | doxygen \ 43 | gtk-doc-tools \ 44 | libarrow-glib-dev \ 45 | libgirepository1.0-dev \ 46 | ninja-build \ 47 | valac 48 | pip install -r requirements.txt 49 | case ${GITHUB_REF} in 50 | refs/tags/*) 51 | version=${GITHUB_REF#refs/tags/} 52 | ;; 53 | *) 54 | version=main 55 | ;; 56 | esac 57 | echo "VERSION=${version}" >> ${GITHUB_ENV} 58 | - uses: actions-rs/toolchain@v1 59 | id: rust-toolchain 60 | with: 61 | override: true 62 | toolchain: stable 63 | - name: Cache Cargo 64 | uses: actions/cache@v4 65 | with: 66 | path: ~/.cargo 67 | key: cargo-doc-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }} 68 | - name: Install cargo-c 69 | uses: actions-rs/cargo@v1 70 | with: 71 | command: install 72 | args: cargo-c 73 | - name: Generate 74 | run: | 75 | meson setup \ 76 | --libdir=lib \ 77 | --prefix=${HOME}/local \ 78 | -Ddoc=true \ 79 | -Dsource-reference=${VERSION} \ 80 | -Dvapi=true \ 81 | -Dwerror=true \ 82 | build \ 83 | . 84 | ninja -C build doc/html 85 | cp -a build/doc/html/ ./ 86 | - uses: actions/upload-artifact@v4 87 | with: 88 | name: html 89 | path: html/ 90 | - uses: actions/checkout@v4 91 | if: | 92 | startsWith(github.ref, 'refs/tags/') || 93 | github.ref == 'refs/heads/main' 94 | with: 95 | ref: gh-pages 96 | path: gh-pages 97 | - name: Deploy 98 | if: | 99 | startsWith(github.ref, 'refs/tags/') || 100 | github.ref == 'refs/heads/main' 101 | run: | 102 | rm -rf gh-pages/${VERSION} 103 | cp -a build/doc/html/ gh-pages/${VERSION} 104 | if [ "${VERSION}" != "main" ]; then 105 | rm -rf gh-pages/latest 106 | cp -a gh-pages/${VERSION} gh-pages/latest 107 | fi 108 | cd gh-pages 109 | if [ "$(git status --porcelain)" != "" ]; then 110 | git config user.name "github-actions[bot]" 111 | git config user.email "github-actions[bot]@users.noreply.github.com" 112 | git add --all 113 | git commit -m "Update by ${GITHUB_SHA}" 114 | git push origin gh-pages 115 | fi 116 | doc_dir=gh-pages/${VERSION} 117 | -------------------------------------------------------------------------------- /.github/workflows/package.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2024 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Package 16 | 17 | on: 18 | - push 19 | - pull_request 20 | 21 | concurrency: 22 | group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | source: 27 | name: Source 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Prepare 31 | run: | 32 | case ${GITHUB_REF} in 33 | refs/tags/*) 34 | version=${GITHUB_REF#refs/tags/} 35 | ;; 36 | *) 37 | version=${GITHUB_SHA} 38 | ;; 39 | esac 40 | echo "VERSION=${version}" >> ${GITHUB_ENV} 41 | - uses: actions/checkout@v4 42 | with: 43 | submodules: true 44 | path: datafusion-c-${{ env.VERSION }} 45 | - name: Archive 46 | run: | 47 | rm -rf datafusion-c-${VERSION}/.git 48 | tar cvzf datafusion-c-${VERSION}.tar.gz datafusion-c-${VERSION} 49 | zip -r datafusion-c-${VERSION}.zip datafusion-c-${VERSION} 50 | - uses: actions/upload-artifact@v4 51 | with: 52 | name: tar.gz 53 | path: datafusion-c-${{ env.VERSION }}.tar.gz 54 | - uses: actions/upload-artifact@v4 55 | with: 56 | name: zip 57 | path: datafusion-c-${{ env.VERSION }}.zip 58 | - name: Release 59 | if: | 60 | startsWith(github.ref, 'refs/tags/') 61 | run: | 62 | gh release create ${GITHUB_REF_NAME} \ 63 | --discussion-category Announcements \ 64 | --notes-file datafusion-c-${VERSION}/doc/source/news/${VERSION}.md \ 65 | --title "DataFucion C ${VERSION}" \ 66 | datafusion-c-${VERSION}.tar.gz 67 | datafusion-c-${VERSION}.zip 68 | env: 69 | GH_TOKEN: ${{ github.token }} 70 | 71 | build: 72 | name: Build 73 | runs-on: ubuntu-22.04 74 | strategy: 75 | fail-fast: false 76 | matrix: 77 | label: 78 | # - AlmaLinux 8 aarch64 79 | - AlmaLinux 8 x86_64 80 | # - AlmaLinux 9 aarch64 81 | - AlmaLinux 9 x86_64 82 | - Debian GNU/Linux bullseye amd64 83 | # - Debian GNU/Linux bullseye arm64 84 | - Debian GNU/Linux bookworm amd64 85 | # - Debian GNU/Linux bookworm arm64 86 | - Ubuntu Focal amd64 87 | # - Ubuntu Focal arm64 88 | - Ubuntu Jammy amd64 89 | # - Ubuntu Jammy arm64 90 | include: 91 | - label: AlmaLinux 8 x86_64 92 | id: almalinux-8-x86_64 93 | task-namespace: yum 94 | target: almalinux-8 95 | test-docker-image: almalinux:8 96 | # - label: AlmaLinux 8 aarch64 97 | # id: almalinux-8-aarch64 98 | # task-namespace: yum 99 | # target: almalinux-8-aarch64 100 | # test-docker-image: arm64v8/almalinux:8 101 | - label: AlmaLinux 9 x86_64 102 | id: almalinux-9-x86_64 103 | task-namespace: yum 104 | target: almalinux-9 105 | test-docker-image: almalinux:9 106 | # - label: AlmaLinux 9 aarch64 107 | # id: almalinux-9-aarch64 108 | # task-namespace: yum 109 | # target: almalinux-9-aarch64 110 | # test-docker-image: arm64v8/almalinux:9 111 | - label: Debian GNU/Linux bullseye amd64 112 | id: debian-bullseye-amd64 113 | task-namespace: apt 114 | target: debian-bullseye 115 | test-docker-image: debian:bullseye 116 | # - label: Debian GNU/Linux bullseye arm64 117 | # id: debian-bullseye-arm64 118 | # task-namespace: apt 119 | # target: debian-bullseye-arm64 120 | # test-docker-image: arm64v8/debian:bullseye 121 | - label: Debian GNU/Linux bookworm amd64 122 | id: debian-bookworm-amd64 123 | task-namespace: apt 124 | target: debian-bookworm 125 | test-docker-image: debian:bookworm 126 | # - label: Debian GNU/Linux bookworm arm64 127 | # id: debian-bookworm-arm64 128 | # task-namespace: apt 129 | # target: debian-bookworm-arm64 130 | # test-docker-image: arm64v8/debian:bookworm 131 | - label: Ubuntu Focal amd64 132 | id: ubuntu-focal-amd64 133 | task-namespace: apt 134 | target: ubuntu-focal 135 | test-docker-image: ubuntu:focal 136 | # - label: Ubuntu Focal arm64 137 | # id: ubuntu-focal-arm64 138 | # task-namespace: apt 139 | # target: ubuntu-focal-arm64 140 | # test-docker-image: arm64v8/ubuntu:focal 141 | - label: Ubuntu Jammy amd64 142 | id: ubuntu-jammy-amd64 143 | task-namespace: apt 144 | target: ubuntu-jammy 145 | test-docker-image: ubuntu:jammy 146 | # - label: Ubuntu Jammy arm64 147 | # id: ubuntu-jammy-arm64 148 | # task-namespace: apt 149 | # target: ubuntu-jammy-arm64 150 | # test-docker-image: arm64v8/ubuntu:jammy 151 | steps: 152 | - uses: actions/checkout@v4 153 | with: 154 | submodules: true 155 | - name: Install dependencies 156 | run: | 157 | sudo apt update 158 | sudo apt -V install \ 159 | devscripts \ 160 | qemu-user-static \ 161 | ruby 162 | - name: Update version 163 | if: | 164 | !startsWith(github.ref, 'refs/tags/') 165 | run: | 166 | cd package 167 | rake version:update RELEASE_DATE=$(date +%Y-%m-%d) 168 | - name: Cache ccache 169 | uses: actions/cache@v4 170 | with: 171 | path: package/${{ matrix.task-namespace }}/build/${{ matrix.target }}/ccache 172 | key: package-${{ matrix.id }}-ccache-${{ hashFiles('datafusion-glib/**/*.{c,h}', 'src/**/*.rs') }} 173 | restore-keys: package-${{ matrix.id }}-ccache- 174 | - name: Build with docker 175 | run: | 176 | cd package 177 | rake ${{ matrix.task-namespace }}:build BUILD_DIR=build 178 | env: 179 | APT_TARGETS: ${{ matrix.target }} 180 | YUM_TARGETS: ${{ matrix.target }} 181 | - uses: actions/upload-artifact@v4 182 | with: 183 | name: package-${{ matrix.id }} 184 | path: package/${{ matrix.task-namespace }}/repositories/ 185 | - name: Create assets 186 | if: | 187 | startsWith(github.ref, 'refs/tags/') 188 | run: | 189 | mkdir -p ${{ matrix.id }} 190 | shopt -s globstar 191 | cp -a package/${{ matrix.task-namespace }}/repositories/**/*.* ${{ matrix.id }}/ 192 | tar czf ${{ matrix.id }}.tar.gz ${{ matrix.id }} 193 | - name: Upload to release 194 | if: | 195 | startsWith(github.ref, 'refs/tags/') 196 | run: 197 | gh release upload ${GITHUB_REF_NAME} \ 198 | ${{ matrix.id }}.tar.gz 199 | env: 200 | GH_TOKEN: ${{ github.token }} 201 | - name: Test 202 | run: | 203 | docker run \ 204 | --rm \ 205 | --volume ${PWD}:/host:ro \ 206 | ${{ matrix.test-docker-image }} \ 207 | /host/package/${{ matrix.task-namespace }}/test.sh \ 208 | local 209 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | /Cargo.lock 16 | /package/*.tar.gz 17 | /package/apt/build.sh 18 | /package/apt/env.sh 19 | /package/apt/repositories/ 20 | /package/apt/tmp/ 21 | /package/yum/build.sh 22 | /package/yum/env.sh 23 | /package/yum/repositories/ 24 | /package/yum/tmp/ 25 | /target 26 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [submodule "vendor/apache-arrow"] 16 | path = vendor/apache-arrow 17 | url = https://github.com/apache/arrow.git 18 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | /vendor/ 16 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | brew "apache-arrow-glib" 18 | brew "glib-utils" 19 | brew "gobject-introspection" 20 | brew "gtk-doc" 21 | brew "meson" 22 | brew "vala" 23 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "datafusion-c" 17 | description = "DataFusion C API" 18 | version = "21.0.0" 19 | homepage = "https://github.com/datafusion-contrib/datafusion-c" 20 | repository = "https://github.com/datafusion-contrib/datafusion-c" 21 | readme = "README.md" 22 | authors = ["Sutou Kouhei "] 23 | license = "Apache-2.0" 24 | keywords = ["arrow", "c"] 25 | edition = "2021" 26 | rust-version = "1.64" 27 | exclude = [ 28 | "/cpp/", 29 | ] 30 | 31 | [lib] 32 | crate-type = ["cdylib"] 33 | name = "datafusion" 34 | 35 | [features] 36 | default = ["capi"] 37 | capi = [] 38 | 39 | [dependencies] 40 | arrow = { version = "34", features = ["ffi", "prettyprint"] } 41 | arrow-data = "34" 42 | datafusion = "21" 43 | libc = "0.2" 44 | parquet = { version = "34", features = ["arrow", "async"] } 45 | tokio = "1" 46 | 47 | [package.metadata.capi.header] 48 | subdirectory = false 49 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | # 3 | # Copyright 2022-2024 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | source "https://rubygems.org/" 18 | 19 | # Use the version of red-arrow based on the available arrow-glib version 20 | red_arrow_version = ">= 0" 21 | IO.pipe do |input, output| 22 | begin 23 | pid = spawn("pkg-config", "--modversion", "arrow-glib", 24 | out: output, 25 | err: File::NULL) 26 | output.close 27 | _, status = Process.waitpid2(pid) 28 | if status.success? 29 | arrow_glib_version = input.read.strip.sub(/-SNAPSHOT\z/, "").strip 30 | red_arrow_version = "<= #{arrow_glib_version}" 31 | end 32 | rescue SystemCallError 33 | end 34 | end 35 | 36 | gem "rake" 37 | gem "red-arrow", red_arrow_version 38 | gem "red-parquet", red_arrow_version 39 | gem "test-unit" 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # DataFusion C API 18 | 19 | C language bindings for DataFusion. 20 | 21 | See https://datafusion-contrib.github.io/datafusion-c/ for details. 22 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | #!#/usr/bin/env python3 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import argparse 18 | import os 19 | import pathlib 20 | import platform 21 | import shutil 22 | import subprocess 23 | 24 | parser = argparse.ArgumentParser(description='Build and copy artifacts ' 25 | 'to the current directory') 26 | parser.add_argument('--version', 27 | action='store', 28 | dest='version', 29 | help='Shared object version', 30 | metavar='VERSION', 31 | required=True) 32 | parser.add_argument('--shared-object', 33 | dest='shared_object', 34 | help='Path to shared object', 35 | metavar='SHARED_OBJECT', 36 | required=True) 37 | parser.add_argument('--file', 38 | action='append', 39 | dest='files', 40 | help='Path to not shared object file ' 41 | '(can be used multiple times)', 42 | metavar='DATA') 43 | parser.add_argument('command_line', nargs='*') 44 | args = parser.parse_args() 45 | 46 | 47 | subprocess.run(args.command_line, check=True) 48 | 49 | 50 | shared_object_base = os.path.basename(args.shared_object) 51 | if platform.system() == 'Linux': 52 | version_major = args.version.split('.')[0] 53 | shutil.copy2(args.shared_object, f'{shared_object_base}.{args.version}') 54 | def ln_fs(src, dest): 55 | try: 56 | os.remove(dest) 57 | except FileNotFoundError: 58 | pass 59 | os.symlink(src, dest) 60 | ln_fs(f'{shared_object_base}.{args.version}', 61 | f'{shared_object_base}.{version_major}') 62 | ln_fs(f'{shared_object_base}.{version_major}', 63 | f'{shared_object_base}') 64 | elif platform.system() == 'Darwin': 65 | version_major = args.version.split('.')[0] 66 | suffix = pathlib.PurePath(shared_object_base).suffix 67 | shared_object_base = pathlib.PurePath(shared_object_base).with_suffix('') 68 | shutil.copy2(args.shared_object, 69 | f'{shared_object_base}.{version_major}{suffix}') 70 | def ln_fs(src, dest): 71 | try: 72 | os.remove(dest) 73 | except FileNotFoundError: 74 | pass 75 | os.symlink(src, dest) 76 | ln_fs(f'{shared_object_base}.{version_major}{suffix}', 77 | f'{shared_object_base}{suffix}') 78 | else: 79 | shutil.copy2(args.shared_object, '.') 80 | 81 | for file in args.files: 82 | shutil.copy2(file, '.') 83 | -------------------------------------------------------------------------------- /cbindgen.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | documentation_length = "full" 16 | language = "C" 17 | pragma_once = true 18 | -------------------------------------------------------------------------------- /cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This is just for mimicking apache/arrow repository to use "archery lint --rat". 16 | -------------------------------------------------------------------------------- /datafusion-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | @PACKAGE_INIT@ 16 | 17 | set(datafusion_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") 18 | set(datafusion_INCLUDE_DIR "${datafusion_PACKAGE_PREFIX_DIR}/@INCLUDE_DIR@") 19 | set(datafusion_LIB_DIR "${datafusion_PACKAGE_PREFIX_DIR}/@LIB_DIR@") 20 | 21 | add_library(datafusion::datafusion SHARED IMPORTED) 22 | set_target_properties(datafusion::datafusion PROPERTIES 23 | INTERFACE_INCLUDE_DIRECTORIES "${datafusion_INCLUDE_DIR}") 24 | if(WIN32) 25 | set_target_properties(datafusion::datafusion PROPERTIES 26 | IMPORTED_LOCATION "${datafusion_LIB_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}datafusion${CMAKE_IMPORT_LIBRARY_SUFFIX}") 27 | else() 28 | set_target_properties(datafusion::datafusion PROPERTIES 29 | IMPORTED_LOCATION "${datafusion_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}datafusion${CMAKE_SHARED_LIBRARY_SUFFIX}.@PACKAGE_VERSION@" 30 | IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}datafusion${CMAKE_SHARED_LIBRARY_SUFFIX}.@PACKAGE_VERSION_MAJOR@") 31 | endif() 32 | -------------------------------------------------------------------------------- /datafusion-glib-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | @PACKAGE_INIT@ 16 | 17 | set(datafusion-glib_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") 18 | set(datafusion-glib_INCLUDE_DIR "${datafusion-glib_PACKAGE_PREFIX_DIR}/@INCLUDE_DIR@") 19 | set(datafusion-glib_LIB_DIR "${datafusion-glib_PACKAGE_PREFIX_DIR}/@LIB_DIR@") 20 | set(datafusion-glib_DEFAULT_LIBRARY "@DEFAULT_LIBRARY@") 21 | 22 | include(CMakeFindDependencyMacro) 23 | find_dependency(arrow-glib) 24 | find_dependency(datafusion) 25 | 26 | if(datafusion-glib_DEFAULT_LIBRARY STREQUAL "shared" OR 27 | datafusion-glib_DEFAULT_LIBRARY STREQUAL "both") 28 | add_library(datafusion-glib::datafusion-glib-shared SHARED IMPORTED) 29 | set_target_properties(datafusion-glib::datafusion-glib-shared PROPERTIES 30 | INTERFACE_INCLUDE_DIRECTORIES "${datafusion-glib_INCLUDE_DIR}" 31 | INTERFACE_LINK_LIBRARIES "datafusion::datafusion;arrow-glib::arrow-glib-shared") 32 | if(WIN32) 33 | set_target_properties(datafusion-glib::datafusion-glib-shared PROPERTIES 34 | IMPORTED_LOCATION "${datafusion-glib_LIB_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}datafusion-glib${CMAKE_IMPORT_LIBRARY_SUFFIX}") 35 | else() 36 | set_target_properties(datafusion-glib::datafusion-glib-shared PROPERTIES 37 | IMPORTED_LOCATION "${datafusion-glib_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}datafusion-glib${CMAKE_SHARED_LIBRARY_SUFFIX}.@PACKAGE_VERSION@" 38 | IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}datafusion-glib.${CMAKE_SHARED_LIBRARY_SUFFIX}.@PACKAGE_VERSION_MAJOR@") 39 | endif() 40 | endif() 41 | 42 | if(datafusion-glib_DEFAULT_LIBRARY STREQUAL "static" OR 43 | datafusion-glib_DEFAULT_LIBRARY STREQUAL "both") 44 | add_library(datafusion-glib::datafusion-glib-static STATIC IMPORTED) 45 | set_target_properties(datafusion-glib::datafusion-glib-static PROPERTIES 46 | IMPORTED_LOCATION "${datafusion-glib_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}datafusion-glib${CMAKE_STATIC_LIBRARY_SUFFIX}" 47 | INTERFACE_INCLUDE_DIRECTORIES "${datafusion-glib_INCLUDE_DIR}" 48 | INTERFACE_LINK_LIBRARIES "datafusion::datafusion;arrow-glib::arrow-glib-static") 49 | endif() 50 | -------------------------------------------------------------------------------- /datafusion-glib/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | /.cache 16 | /compile_commands.json 17 | -------------------------------------------------------------------------------- /datafusion-glib/csv-read-options-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | GDF_AVAILABLE_IN_10_0 26 | DFCSVReadOptions * 27 | gdf_csv_read_options_get_raw(GDFCSVReadOptions *context); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /datafusion-glib/csv-read-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | #define GDF_TYPE_CSV_READ_OPTIONS (gdf_csv_read_options_get_type()) 26 | G_DECLARE_DERIVABLE_TYPE(GDFCSVReadOptions, 27 | gdf_csv_read_options, 28 | GDF, 29 | CSV_READ_OPTIONS, 30 | GObject) 31 | struct _GDFCSVReadOptionsClass 32 | { 33 | GObjectClass parent_class; 34 | }; 35 | 36 | GDF_AVAILABLE_IN_10_0 37 | GDFCSVReadOptions * 38 | gdf_csv_read_options_new(void); 39 | 40 | GDF_AVAILABLE_IN_10_0 41 | gboolean 42 | gdf_csv_read_options_set_schema(GDFCSVReadOptions *options, 43 | GArrowSchema *schema, 44 | GError **error); 45 | GDF_AVAILABLE_IN_10_0 46 | GArrowSchema * 47 | gdf_csv_read_options_get_schema(GDFCSVReadOptions *options); 48 | 49 | GDF_AVAILABLE_IN_10_0 50 | gboolean 51 | gdf_csv_read_options_set_file_extension(GDFCSVReadOptions *options, 52 | const gchar *extension, 53 | GError **error); 54 | GDF_AVAILABLE_IN_10_0 55 | const gchar * 56 | gdf_csv_read_options_get_file_extension(GDFCSVReadOptions *options); 57 | 58 | GDF_AVAILABLE_IN_10_0 59 | gboolean 60 | gdf_csv_read_options_set_table_partition_columns(GDFCSVReadOptions *options, 61 | GArrowSchema *schema, 62 | GError **error); 63 | GDF_AVAILABLE_IN_10_0 64 | GArrowSchema * 65 | gdf_csv_read_options_get_table_partition_columns(GDFCSVReadOptions *options); 66 | 67 | 68 | 69 | G_END_DECLS 70 | -------------------------------------------------------------------------------- /datafusion-glib/data-frame-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | GDF_AVAILABLE_IN_10_0 26 | GDFDataFrame * 27 | gdf_data_frame_new_raw(DFDataFrame *raw_data_frame); 28 | 29 | GDF_AVAILABLE_IN_21_0 30 | DFParquetWriterProperties * 31 | gdf_parquet_writer_properties_get_raw(GDFParquetWriterProperties *properties); 32 | 33 | G_END_DECLS 34 | -------------------------------------------------------------------------------- /datafusion-glib/data-frame.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | G_BEGIN_DECLS 21 | 22 | /** 23 | * SECTION: data-frame 24 | * @include: datafusion-glib/datafusion-glib.h 25 | * 26 | * #GDFParquertWriterProperties is a class to customize how to write 27 | * an Apache Parquet file. 28 | * 29 | * #GDFDataFrame is a data frame class. 30 | */ 31 | 32 | typedef struct GDFParquetWriterPropertiesPrivate_ { 33 | DFParquetWriterProperties *properties; 34 | } GDFParquetWriterPropertiesPrivate; 35 | 36 | enum { 37 | PROP_PARQUET_WRITER_PROPERTIES = 1, 38 | }; 39 | 40 | G_DEFINE_TYPE_WITH_PRIVATE(GDFParquetWriterProperties, 41 | gdf_parquet_writer_properties, 42 | G_TYPE_OBJECT) 43 | 44 | static void 45 | gdf_parquet_writer_properties_finalize(GObject *object) 46 | { 47 | GDFParquetWriterPropertiesPrivate *priv = 48 | gdf_parquet_writer_properties_get_instance_private( 49 | GDF_PARQUET_WRITER_PROPERTIES(object)); 50 | df_parquet_writer_properties_free(priv->properties); 51 | G_OBJECT_CLASS(gdf_parquet_writer_properties_parent_class)->finalize(object); 52 | } 53 | 54 | static void 55 | gdf_parquet_writer_properties_init(GDFParquetWriterProperties *object) 56 | { 57 | GDFParquetWriterPropertiesPrivate *priv = 58 | gdf_parquet_writer_properties_get_instance_private( 59 | GDF_PARQUET_WRITER_PROPERTIES(object)); 60 | priv->properties = df_parquet_writer_properties_new(); 61 | } 62 | 63 | static void 64 | gdf_parquet_writer_properties_class_init(GDFParquetWriterPropertiesClass *klass) 65 | { 66 | GObjectClass *gobject_class = G_OBJECT_CLASS(klass); 67 | gobject_class->finalize = gdf_parquet_writer_properties_finalize; 68 | } 69 | 70 | /** 71 | * gdf_parquet_writer_properties_new: 72 | * 73 | * Returns: A new Apache Parquet writer properties. 74 | * 75 | * Since: 21.0.0 76 | */ 77 | GDFParquetWriterProperties * 78 | gdf_parquet_writer_properties_new(void) 79 | { 80 | return g_object_new(GDF_TYPE_PARQUET_WRITER_PROPERTIES, NULL); 81 | } 82 | 83 | /** 84 | * gdf_parquet_writer_properties_set_max_row_group_size: 85 | * @properties: A #GDFParquetWriterProperties. 86 | * @size: The maximum number of rows in a row group. 87 | * 88 | * Set the maximum number of rows in a row group. 89 | * 90 | * Since: 21.0.0 91 | */ 92 | void 93 | gdf_parquet_writer_properties_set_max_row_group_size( 94 | GDFParquetWriterProperties *properties, 95 | guint64 size) 96 | { 97 | GDFParquetWriterPropertiesPrivate *priv = 98 | gdf_parquet_writer_properties_get_instance_private(properties); 99 | df_parquet_writer_properties_set_max_row_group_size(priv->properties, size); 100 | } 101 | 102 | 103 | typedef struct GDFDataFramePrivate_ { 104 | DFDataFrame *data_frame; 105 | } GDFDataFramePrivate; 106 | 107 | enum { 108 | PROP_DATA_FRAME = 1, 109 | }; 110 | 111 | G_DEFINE_TYPE_WITH_PRIVATE(GDFDataFrame, 112 | gdf_data_frame, 113 | G_TYPE_OBJECT) 114 | 115 | static void 116 | gdf_data_frame_finalize(GObject *object) 117 | { 118 | GDFDataFramePrivate *priv = 119 | gdf_data_frame_get_instance_private(GDF_DATA_FRAME(object)); 120 | df_data_frame_free(priv->data_frame); 121 | G_OBJECT_CLASS(gdf_data_frame_parent_class)->finalize(object); 122 | } 123 | 124 | static void 125 | gdf_data_frame_set_property(GObject *object, 126 | guint prop_id, 127 | const GValue *value, 128 | GParamSpec *pspec) 129 | { 130 | GDFDataFramePrivate *priv = 131 | gdf_data_frame_get_instance_private(GDF_DATA_FRAME(object)); 132 | 133 | switch (prop_id) { 134 | case PROP_DATA_FRAME: 135 | priv->data_frame = g_value_get_pointer(value); 136 | break; 137 | default: 138 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); 139 | break; 140 | } 141 | } 142 | 143 | static void 144 | gdf_data_frame_init(GDFDataFrame *object) 145 | { 146 | } 147 | 148 | static void 149 | gdf_data_frame_class_init(GDFDataFrameClass *klass) 150 | { 151 | GObjectClass *gobject_class = G_OBJECT_CLASS(klass); 152 | gobject_class->finalize = gdf_data_frame_finalize; 153 | gobject_class->set_property = gdf_data_frame_set_property; 154 | 155 | GParamSpec *spec; 156 | spec = g_param_spec_pointer("data-frame", 157 | "Data frame", 158 | "The raw DFDataFrame *", 159 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); 160 | g_object_class_install_property(gobject_class, PROP_DATA_FRAME, spec); 161 | } 162 | 163 | /** 164 | * gdf_data_frame_show: 165 | * @data_frame: A #GDFDataFrame. 166 | * @error: (nullable): Return location for a #GError or %NULL. 167 | * 168 | * Shows @data_frame content to standard output. 169 | * 170 | * Since: 10.0.0 171 | */ 172 | gboolean 173 | gdf_data_frame_show(GDFDataFrame *data_frame, GError **error) 174 | { 175 | GDFDataFramePrivate *priv = gdf_data_frame_get_instance_private(data_frame); 176 | DFError *df_error = NULL; 177 | df_data_frame_show(priv->data_frame, &df_error); 178 | if (df_error) { 179 | g_set_error(error, 180 | GDF_ERROR, 181 | df_error_get_code(df_error), 182 | "[data-frame][show] %s", 183 | df_error_get_message(df_error)); 184 | df_error_free(df_error); 185 | return FALSE; 186 | } else { 187 | return TRUE; 188 | } 189 | } 190 | 191 | /** 192 | * gdf_data_frame_to_table: 193 | * @data_frame: A #GDFDataFrame. 194 | * @error: (nullable): Return location for a #GError or %NULL. 195 | * 196 | * Returns: (transfer full): A #GArrowTable of this data frame, %NULL on error. 197 | * 198 | * Since: 10.0.0 199 | */ 200 | GArrowTable * 201 | gdf_data_frame_to_table(GDFDataFrame *data_frame, GError **error) 202 | { 203 | GDFDataFramePrivate *priv = gdf_data_frame_get_instance_private(data_frame); 204 | DFArrowSchema *c_abi_schema; 205 | DFArrowArray **c_abi_record_batches; 206 | DFError *df_error = NULL; 207 | gint64 n = df_data_frame_export(priv->data_frame, 208 | &c_abi_schema, 209 | &c_abi_record_batches, 210 | &df_error); 211 | if (n < 0) { 212 | g_set_error(error, 213 | GDF_ERROR, 214 | df_error_get_code(df_error), 215 | "[data-frame][to-table] %s", 216 | df_error_get_message(df_error)); 217 | df_error_free(df_error); 218 | return NULL; 219 | } 220 | 221 | GArrowSchema *schema = garrow_schema_import(c_abi_schema, error); 222 | GArrowRecordBatch **record_batches = g_newa(GArrowRecordBatch *, n); 223 | gint64 i; 224 | for (i = 0; i < n; i++) { 225 | record_batches[i] = garrow_record_batch_import(c_abi_record_batches[i], 226 | schema, 227 | error); 228 | } 229 | free(c_abi_record_batches); 230 | GArrowTable *table = 231 | garrow_table_new_record_batches(schema, record_batches, n, error); 232 | for (i = 0; i < n; i++) { 233 | g_object_unref(record_batches[i]); 234 | } 235 | g_object_unref(schema); 236 | return table; 237 | } 238 | 239 | /** 240 | * gdf_data_frame_write_parquet: 241 | * @data_frame: A #GDFDataFrame. 242 | * @path: An output path. 243 | * @properties: (nullable): Properties how to write Apache Parquet files. 244 | * @error: (nullable): Return location for a #GError or %NULL. 245 | * 246 | * Returns: %TRUE on success, %FALSE otherwise. 247 | * 248 | * Since: 21.0.0 249 | */ 250 | gboolean 251 | gdf_data_frame_write_parquet(GDFDataFrame *data_frame, 252 | const gchar *path, 253 | GDFParquetWriterProperties *properties, 254 | GError **error) 255 | { 256 | GDFDataFramePrivate *priv = gdf_data_frame_get_instance_private(data_frame); 257 | DFParquetWriterProperties *df_properties = NULL; 258 | if (properties) { 259 | df_properties = gdf_parquet_writer_properties_get_raw(properties); 260 | } 261 | DFError *df_error = NULL; 262 | gboolean success = df_data_frame_write_parquet(priv->data_frame, 263 | path, 264 | df_properties, 265 | &df_error); 266 | if (!success) { 267 | g_set_error(error, 268 | GDF_ERROR, 269 | df_error_get_code(df_error), 270 | "[data-frame][write-parquet] %s", 271 | df_error_get_message(df_error)); 272 | df_error_free(df_error); 273 | } 274 | return success; 275 | } 276 | 277 | GDFDataFrame * 278 | gdf_data_frame_new_raw(DFDataFrame *data_frame) 279 | { 280 | return g_object_new(GDF_TYPE_DATA_FRAME, 281 | "data-frame", data_frame, 282 | NULL); 283 | } 284 | 285 | DFParquetWriterProperties * 286 | gdf_parquet_writer_properties_get_raw(GDFParquetWriterProperties *properties) 287 | { 288 | GDFParquetWriterPropertiesPrivate *priv = 289 | gdf_parquet_writer_properties_get_instance_private(properties); 290 | return priv->properties; 291 | } 292 | -------------------------------------------------------------------------------- /datafusion-glib/data-frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | #define GDF_TYPE_PARQUET_WRITER_PROPERTIES \ 26 | (gdf_parquet_writer_properties_get_type()) 27 | G_DECLARE_DERIVABLE_TYPE(GDFParquetWriterProperties, 28 | gdf_parquet_writer_properties, 29 | GDF, 30 | PARQUET_WRITER_PROPERTIES, 31 | GObject) 32 | struct _GDFParquetWriterPropertiesClass 33 | { 34 | GObjectClass parent_class; 35 | }; 36 | 37 | GDF_AVAILABLE_IN_21_0 38 | GDFParquetWriterProperties * 39 | gdf_parquet_writer_properties_new(void); 40 | GDF_AVAILABLE_IN_21_0 41 | void 42 | gdf_parquet_writer_properties_set_max_row_group_size( 43 | GDFParquetWriterProperties *properties, 44 | guint64 size); 45 | 46 | #define GDF_TYPE_DATA_FRAME (gdf_data_frame_get_type()) 47 | G_DECLARE_DERIVABLE_TYPE(GDFDataFrame, 48 | gdf_data_frame, 49 | GDF, 50 | DATA_FRAME, 51 | GObject) 52 | struct _GDFDataFrameClass 53 | { 54 | GObjectClass parent_class; 55 | }; 56 | 57 | GDF_AVAILABLE_IN_10_0 58 | gboolean 59 | gdf_data_frame_show(GDFDataFrame *data_frame, GError **error); 60 | GDF_AVAILABLE_IN_10_0 61 | GArrowTable * 62 | gdf_data_frame_to_table(GDFDataFrame *data_frame, GError **error); 63 | GDF_AVAILABLE_IN_21_0 64 | gboolean 65 | gdf_data_frame_write_parquet(GDFDataFrame *data_frame, 66 | const gchar *path, 67 | GDFParquetWriterProperties *properties, 68 | GError **error); 69 | 70 | 71 | G_END_DECLS 72 | -------------------------------------------------------------------------------- /datafusion-glib/datafusion-glib-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | -------------------------------------------------------------------------------- /datafusion-glib/datafusion-glib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | -------------------------------------------------------------------------------- /datafusion-glib/error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | G_BEGIN_DECLS 22 | 23 | /** 24 | * SECTION: error 25 | * @include: datafusion-glib/datafusion-glib.h 26 | * 27 | * #GDFError provides error codes. 28 | */ 29 | 30 | G_DEFINE_QUARK(gdf-error-quark, gdf_error) 31 | -------------------------------------------------------------------------------- /datafusion-glib/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | /** 26 | * GDFError: 27 | * @GDF_ERROR_ARROW: Error returned by arrow crate. 28 | * @GDF_ERROR_PARQUET: Error returned by parquet crate. 29 | * @GDF_ERROR_AVRO: Error returned by avro-rs crate. 30 | * @GDF_ERROR_OBJECT_STORE: Error returned by object_store crate. 31 | * @GDF_ERROR_IO: Error associated to I/O operations and associated traits. 32 | * @GDF_ERROR_SQL: Error returned when SQL is syntactically incorrect. 33 | * @GDF_ERROR_NOT_IMPLEMENTED: Error returned on a branch that we know it is 34 | * possible but to which we still have no implementation for. 35 | * Often, these errors are tracked in our issue tracker. 36 | * @GDF_ERROR_INTERNAL: Error returned as a consequence of an error in 37 | * DataFusion. This error should not happen in normal usage of DataFusion. 38 | * @GDF_ERROR_PLAN: This error happens whenever a plan is not valid. Examples 39 | * include impossible casts. 40 | * @GDF_ERROR_SCHEMA: This error happens with schema-related errors, such as 41 | * schema inference not possible and non-unique column names. 42 | * @GDF_ERROR_EXECUTION: Error returned during execution of the query. 43 | * Examples include files not found, errors in parsing certain types. 44 | * @GDF_ERROR_RESOURCES_EXHAUSTED: This error is thrown when a consumer cannot 45 | * acquire memory from the Memory Manager we can just cancel the execution 46 | * of the partition. 47 | * @GDF_ERROR_EXTERNAL: For example, a custom S3Error from the crate 48 | * datafusion-objectstore-s3. 49 | * @GDF_ERROR_JIT: Error occurs during code generation. 50 | * 51 | * The error codes are used by all datafusion-glib functions. 52 | * 53 | * They are corresponding to `DFErrorCode` values. 54 | * 55 | * Since: 10.0.0 56 | */ 57 | typedef enum { 58 | GDF_ERROR_ARROW, 59 | GDF_ERROR_PARQUET, 60 | GDF_ERROR_AVRO, 61 | GDF_ERROR_OBJECT_STORE, 62 | GDF_ERROR_IO, 63 | GDF_ERROR_SQL, 64 | GDF_ERROR_NOT_IMPLEMENTED, 65 | GDF_ERROR_INTERNAL, 66 | GDF_ERROR_PLAN, 67 | GDF_ERROR_SCHEMA, 68 | GDF_ERROR_EXECUTION, 69 | GDF_ERROR_RESOURCES_EXHAUSTED, 70 | GDF_ERROR_EXTERNAL, 71 | GDF_ERROR_JIT, 72 | } GDFError; 73 | 74 | #define GDF_ERROR gdf_error_quark() 75 | 76 | GQuark gdf_error_quark(void); 77 | 78 | G_END_DECLS 79 | -------------------------------------------------------------------------------- /datafusion-glib/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | sources = files( 16 | 'csv-read-options.c', 17 | 'data-frame.c', 18 | 'error.c', 19 | 'parquet-read-options.c', 20 | 'session-context.c', 21 | ) 22 | 23 | headers = files( 24 | 'csv-read-options.h', 25 | 'data-frame.h', 26 | 'datafusion-glib.h', 27 | 'error.h', 28 | 'parquet-read-options.h', 29 | 'session-context.h', 30 | ) 31 | 32 | raw_headers = files( 33 | 'csv-read-options-raw.h', 34 | 'data-frame-raw.h', 35 | 'datafusion-glib-raw.h', 36 | 'parquet-read-options-raw.h', 37 | 'session-context-raw.h', 38 | ) 39 | 40 | version_h_conf = configuration_data() 41 | version_h_conf.set('GDF_VERSION_MAJOR', version_major) 42 | version_h_conf.set('GDF_VERSION_MINOR', version_minor) 43 | version_h_conf.set('GDF_VERSION_MICRO', version_micro) 44 | version_h = configure_file(input: 'version.h.in', 45 | output: 'version.h', 46 | configuration: version_h_conf) 47 | headers += version_h 48 | 49 | gnome = import('gnome') 50 | enums = gnome.mkenums_simple('enums', 51 | identifier_prefix: 'GDF', 52 | install_dir: include_dir / 'datafusion-glib', 53 | install_header: true, 54 | sources: headers, 55 | symbol_prefix: 'gdf') 56 | enums_source = enums[0] 57 | enums_header = enums[1] 58 | 59 | 60 | install_headers(headers + raw_headers, subdir: 'datafusion-glib') 61 | 62 | 63 | gobject = dependency('gobject-2.0') 64 | dependencies = [ 65 | datafusion, 66 | arrow_glib, 67 | gobject, 68 | ] 69 | libdatafusion_glib = library('datafusion-glib', 70 | dependencies: dependencies, 71 | include_directories: include_directories('..'), 72 | install: true, 73 | sources: sources + headers + raw_headers + enums, 74 | soversion: so_version, 75 | version: library_version) 76 | datafusion_glib = declare_dependency(dependencies: dependencies, 77 | link_with: libdatafusion_glib, 78 | sources: enums_header) 79 | 80 | pkgconfig = import('pkgconfig') 81 | pkgconfig.generate(libdatafusion_glib, 82 | description: 'GLib API for DataFusion', 83 | filebase: 'datafusion-glib', 84 | name: 'DataFusion GLib', 85 | requires: ['datafusion', 'arrow-glib', 'gobject-2.0'], 86 | variables: pkgconfig_variables, 87 | version: version) 88 | 89 | if have_gi 90 | datafusion_glib_gir = \ 91 | gnome.generate_gir(libdatafusion_glib, 92 | dependencies: dependencies, 93 | export_packages: 'datafusion-glib', 94 | extra_args: [ 95 | '--warn-all', 96 | ], 97 | fatal_warnings: true, 98 | header: 'datafusion-glib/datafusion-glib.h', 99 | identifier_prefix: 'GDF', 100 | includes: [ 101 | 'Arrow-1.0', 102 | 'GObject-2.0', 103 | ], 104 | install: true, 105 | namespace: 'DataFusion', 106 | nsversion: api_version, 107 | sources: sources + headers + enums, 108 | symbol_prefix: 'gdf') 109 | 110 | if generate_vapi 111 | datafusion_glib_vapi = \ 112 | gnome.generate_vapi('datafusion-glib', 113 | gir_dirs: [ 114 | arrow_glib.get_variable('girdir'), 115 | ], 116 | install: true, 117 | packages: ['arrow-glib', 'gobject-2.0'], 118 | sources: [datafusion_glib_gir[0]], 119 | vapi_dirs: [ 120 | arrow_glib.get_variable('vapidir'), 121 | ]) 122 | endif 123 | endif 124 | -------------------------------------------------------------------------------- /datafusion-glib/parquet-read-options-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | GDF_AVAILABLE_IN_10_0 26 | DFParquetReadOptions * 27 | gdf_parquet_read_options_get_raw(GDFParquetReadOptions *context); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /datafusion-glib/parquet-read-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | #define GDF_TYPE_PARQUET_READ_OPTIONS (gdf_parquet_read_options_get_type()) 26 | G_DECLARE_DERIVABLE_TYPE(GDFParquetReadOptions, 27 | gdf_parquet_read_options, 28 | GDF, 29 | PARQUET_READ_OPTIONS, 30 | GObject) 31 | struct _GDFParquetReadOptionsClass 32 | { 33 | GObjectClass parent_class; 34 | }; 35 | 36 | GDF_AVAILABLE_IN_10_0 37 | GDFParquetReadOptions * 38 | gdf_parquet_read_options_new(void); 39 | 40 | GDF_AVAILABLE_IN_10_0 41 | gboolean 42 | gdf_parquet_read_options_set_file_extension(GDFParquetReadOptions *options, 43 | const gchar *extension, 44 | GError **error); 45 | GDF_AVAILABLE_IN_10_0 46 | const gchar * 47 | gdf_parquet_read_options_get_file_extension(GDFParquetReadOptions *options); 48 | 49 | GDF_AVAILABLE_IN_10_0 50 | gboolean 51 | gdf_parquet_read_options_set_table_partition_columns( 52 | GDFParquetReadOptions *options, 53 | GArrowSchema *schema, 54 | GError **error); 55 | GDF_AVAILABLE_IN_10_0 56 | GArrowSchema * 57 | gdf_parquet_read_options_get_table_partition_columns( 58 | GDFParquetReadOptions *options); 59 | 60 | GDF_AVAILABLE_IN_21_0 61 | void 62 | gdf_parquet_read_options_unset_pruning(GDFParquetReadOptions *options); 63 | 64 | GDF_AVAILABLE_IN_21_0 65 | gboolean 66 | gdf_parquet_read_options_is_set_pruning(GDFParquetReadOptions *options); 67 | 68 | 69 | G_END_DECLS 70 | -------------------------------------------------------------------------------- /datafusion-glib/session-context-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | GDF_AVAILABLE_IN_10_0 26 | GDFSessionContext * 27 | gdf_session_context_new_raw(DFSessionContext *raw_context); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /datafusion-glib/session-context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define GDF_TYPE_SESSION_CONTEXT (gdf_session_context_get_type()) 28 | G_DECLARE_DERIVABLE_TYPE(GDFSessionContext, 29 | gdf_session_context, 30 | GDF, 31 | SESSION_CONTEXT, 32 | GObject) 33 | struct _GDFSessionContextClass 34 | { 35 | GObjectClass parent_class; 36 | }; 37 | 38 | GDF_AVAILABLE_IN_10_0 39 | GDFSessionContext * 40 | gdf_session_context_new(void); 41 | GDF_AVAILABLE_IN_10_0 42 | GDFDataFrame * 43 | gdf_session_context_sql(GDFSessionContext *context, 44 | const gchar *sql, 45 | GError **error); 46 | GDF_AVAILABLE_IN_10_0 47 | gboolean 48 | gdf_session_context_deregister(GDFSessionContext *context, 49 | const gchar *name, 50 | GError **error); 51 | GDF_AVAILABLE_IN_10_0 52 | gboolean 53 | gdf_session_context_register_record_batch(GDFSessionContext *context, 54 | const gchar *name, 55 | GArrowRecordBatch *record_batch, 56 | GError **error); 57 | GDF_AVAILABLE_IN_10_0 58 | gboolean 59 | gdf_session_context_register_table(GDFSessionContext *context, 60 | const gchar *name, 61 | GArrowTable *table, 62 | GError **error); 63 | 64 | GDF_AVAILABLE_IN_10_0 65 | gboolean 66 | gdf_session_context_register_csv(GDFSessionContext *context, 67 | const gchar *name, 68 | const gchar *url, 69 | GDFCSVReadOptions *options, 70 | GError **error); 71 | 72 | GDF_AVAILABLE_IN_10_0 73 | gboolean 74 | gdf_session_context_register_parquet(GDFSessionContext *context, 75 | const gchar *name, 76 | const gchar *url, 77 | GDFParquetReadOptions *options, 78 | GError **error); 79 | 80 | 81 | G_END_DECLS 82 | -------------------------------------------------------------------------------- /datafusion-glib/version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | /** 22 | * SECTION: version 23 | * @section_id: version-macros 24 | * @title: Version related macros 25 | * @include: datafusion-glib/datafusion-glib.h 26 | * 27 | * DataFusion GLib provides macros that can be used by C pre-processor. 28 | * They are useful to check version related things at compile time. 29 | */ 30 | 31 | /** 32 | * GDF_VERSION_MAJOR: 33 | * 34 | * The major version. 35 | * 36 | * Since: 10.0.0 37 | */ 38 | #define GDF_VERSION_MAJOR (@GDF_VERSION_MAJOR@) 39 | 40 | /** 41 | * GDF_VERSION_MINOR: 42 | * 43 | * The minor version. 44 | * 45 | * Since: 10.0.0 46 | */ 47 | #define GDF_VERSION_MINOR (@GDF_VERSION_MINOR@) 48 | 49 | /** 50 | * GDF_VERSION_MICRO: 51 | * 52 | * The micro version. 53 | * 54 | * Since: 10.0.0 55 | */ 56 | #define GDF_VERSION_MICRO (@GDF_VERSION_MICRO@) 57 | 58 | /** 59 | * GDF_VERSION_CHECK: 60 | * @major: A major version to check for. 61 | * @minor: A minor version to check for. 62 | * @micro: A micro version to check for. 63 | * 64 | * You can use this macro in C pre-processor. 65 | * 66 | * Returns: %TRUE if the compile time DataFusion GLib version is the 67 | * same as or newer than the passed version, %FALSE otherwise. 68 | * 69 | * Since: 10.0.0 70 | */ 71 | #define GDF_VERSION_CHECK(major, minor, micro) \ 72 | (GDF_VERSION_MAJOR > (major) || \ 73 | (GDF_VERSION_MAJOR == (major) && \ 74 | GDF_VERSION_MINOR > (minor)) || \ 75 | (GDF_VERSION_MAJOR == (major) && \ 76 | GDF_VERSION_MINOR == (minor) && \ 77 | GDF_VERSION_MICRO >= (micro))) 78 | 79 | /** 80 | * GDF_DISABLE_DEPRECATION_WARNINGS: 81 | * 82 | * If this macro is defined, no deprecated warnings are produced. 83 | * 84 | * You must define this macro before including the 85 | * arrow-glib/arrow-glib.h header. 86 | * 87 | * Since: 10.0.0 88 | */ 89 | 90 | #ifdef GDF_DISABLE_DEPRECATION_WARNINGS 91 | # define GDF_DEPRECATED 92 | # define GDF_DEPRECATED_FOR(function) 93 | # define GDF_UNAVAILABLE(major, minor) 94 | #else 95 | # define GDF_DEPRECATED G_DEPRECATED 96 | # define GDF_DEPRECATED_FOR(function) G_DEPRECATED_FOR(function) 97 | # define GDF_UNAVAILABLE(major, minor) G_UNAVAILABLE(major, minor) 98 | #endif 99 | 100 | /** 101 | * GDF_VERSION_21_0: 102 | * 103 | * You can use this macro value for compile time API version check. 104 | * 105 | * Since: 21.0.0 106 | */ 107 | #define GDF_VERSION_21_0 G_ENCODE_VERSION(21, 0) 108 | 109 | /** 110 | * GDF_VERSION_10_0: 111 | * 112 | * You can use this macro value for compile time API version check. 113 | * 114 | * Since: 10.0.0 115 | */ 116 | #define GDF_VERSION_10_0 G_ENCODE_VERSION(10, 0) 117 | 118 | /** 119 | * GDF_VERSION_MIN_REQUIRED: 120 | * 121 | * You can use this macro for compile time API version check. 122 | * 123 | * This macro value must be one of the predefined version macros such 124 | * as %GDF_VERSION_10_0. 125 | * 126 | * If you use any functions that is defined by newer version than 127 | * %GDF_VERSION_MIN_REQUIRED, deprecated warnings are produced at 128 | * compile time. 129 | * 130 | * You must define this macro before including the 131 | * datafusion-glib/datafusion-glib.h header. 132 | * 133 | * Since: 10.0.0 134 | */ 135 | #ifndef GDF_VERSION_MIN_REQUIRED 136 | # define GDF_VERSION_MIN_REQUIRED \ 137 | G_ENCODE_VERSION(GDF_VERSION_MAJOR, GDF_VERSION_MINOR) 138 | #endif 139 | 140 | /** 141 | * GDF_VERSION_MAX_ALLOWED: 142 | * 143 | * You can use this macro for compile time API version check. 144 | * 145 | * This macro value must be one of the predefined version macros such 146 | * as %GDF_VERSION_10_0. 147 | * 148 | * If you use any functions that is defined by newer version than 149 | * %GDF_VERSION_MAX_ALLOWED, deprecated warnings are produced at 150 | * compile time. 151 | * 152 | * You must define this macro before including the 153 | * datafusion-glib/datafusion-glib.h header. 154 | * 155 | * Since: 10.0.0 156 | */ 157 | #ifndef GDF_VERSION_MAX_ALLOWED 158 | # define GDF_VERSION_MAX_ALLOWED \ 159 | G_ENCODE_VERSION(GDF_VERSION_MAJOR, GDF_VERSION_MINOR) 160 | #endif 161 | 162 | 163 | #define GDF_AVAILABLE_IN_ALL 164 | 165 | 166 | #if GDF_VERSION_MIN_REQUIRED >= GDF_VERSION_21_0 167 | # define GDF_DEPRECATED_IN_21_0 GDF_DEPRECATED 168 | # define GDF_DEPRECATED_IN_21_0_FOR(function) GDF_DEPRECATED_FOR(function) 169 | #else 170 | # define GDF_DEPRECATED_IN_21_0 171 | # define GDF_DEPRECATED_IN_21_0_FOR(function) 172 | #endif 173 | 174 | #if GDF_VERSION_MAX_ALLOWED < GDF_VERSION_21_0 175 | # define GDF_AVAILABLE_IN_21_0 GDF_UNAVAILABLE(21, 0) 176 | #else 177 | # define GDF_AVAILABLE_IN_21_0 178 | #endif 179 | 180 | 181 | #if GDF_VERSION_MIN_REQUIRED >= GDF_VERSION_10_0 182 | # define GDF_DEPRECATED_IN_10_0 GDF_DEPRECATED 183 | # define GDF_DEPRECATED_IN_10_0_FOR(function) GDF_DEPRECATED_FOR(function) 184 | #else 185 | # define GDF_DEPRECATED_IN_10_0 186 | # define GDF_DEPRECATED_IN_10_0_FOR(function) 187 | #endif 188 | 189 | #if GDF_VERSION_MAX_ALLOWED < GDF_VERSION_10_0 190 | # define GDF_AVAILABLE_IN_10_0 GDF_UNAVAILABLE(10, 0) 191 | #else 192 | # define GDF_AVAILABLE_IN_10_0 193 | #endif 194 | -------------------------------------------------------------------------------- /dev/release/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # Release 18 | 19 | See https://datafusion-contrib.github.io/datafusion-c/main/developer/release.html . 20 | -------------------------------------------------------------------------------- /dev/release/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eux 18 | 19 | if [ $# -lt 1 ]; then 20 | echo "Usage: $0 version" 21 | echo " e.g.: $0 11.0.0" 22 | exit 1 23 | fi 24 | 25 | version=$1 26 | major_version=$(echo ${version} | grep -o -E '^[0-9]+') 27 | 28 | source_dir="$(dirname "$0")/../.." 29 | 30 | git fetch origin --tags 31 | 32 | branch="prepare-${version}" 33 | git branch -D ${branch} || : 34 | git checkout -b ${branch} origin/main 35 | 36 | pushd "${source_dir}" 37 | sed -i'.bak' \ 38 | -e "s/^version = \".*\"/version = \"${version}\"/" \ 39 | Cargo.toml 40 | rm Cargo.toml.bak 41 | git add Cargo.toml 42 | 43 | sed -i'.bak' \ 44 | -e "s/^version = \'.*\'/version = \"${version}\"/" \ 45 | meson.build 46 | rm meson.build.bak 47 | git add meson.build 48 | popd 49 | 50 | pushd "${source_dir}/package/debian/" 51 | sed -i'.bak' -E \ 52 | -e "s/libdatafusion[0-9]+/libdatafusion${major_version}/g" \ 53 | -e "s/libdatafusion-glib[0-9]+/libdatafusion-glib${major_version}/g" \ 54 | -e "s/gir1\.2-datafusion-[0-9]+/gir1.2-datafusion-${major_version}/g" \ 55 | control 56 | rm control.bak 57 | git add control 58 | git mv gir1.2-datafusion-*.install \ 59 | gir1.2-datafusion-${major_version}.0.install 60 | git mv libdatafusion-glib[[:alnum:]]*.install \ 61 | libdatafusion-glib${major_version}.install 62 | git mv libdatafusion[[:alnum:]]*.install \ 63 | libdatafusion${major_version}.install 64 | popd 65 | 66 | pushd "${source_dir}/doc/" 67 | latest_news_md=$(ls source/news/*.md | sort -n -r | head -n1) 68 | sed \ 69 | -e "s/^# .*\$/# ${version} - $(date +%Y-%m-%d)/" \ 70 | ${latest_news_md} > source/news/${version}.md 71 | git add source/news/${version}.md 72 | sed -i'.bak' \ 73 | -e "N; /^\.\. toctree::/ a \ \ \ news/${version}" \ 74 | source/news.rst 75 | rm source/news.rst.bak 76 | git add source/news.rst 77 | sed -i'.bak' \ 78 | -e "\,^ 'source' / 'news\.rst', i \ \ 'source' / 'news' / '${version}.md'," \ 79 | meson.build 80 | rm meson.build.bak 81 | git add meson.build 82 | popd 83 | 84 | pushd "${source_dir}/package" 85 | rake version:update 86 | git add apt/debian/ 87 | git add yum/*.spec.in 88 | popd 89 | -------------------------------------------------------------------------------- /dev/release/rat_exclude_files.txt: -------------------------------------------------------------------------------- 1 | dev/release/rat_exclude_files.txt 2 | doc/source/_static/switcher.json 3 | package/debian/compat 4 | package/debian/control 5 | package/debian/*.doc-base 6 | package/debian/*.install 7 | package/debian/*.links 8 | package/debian/rules 9 | -------------------------------------------------------------------------------- /dev/release/tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eux 18 | 19 | source_dir="$(dirname "$0")/../.." 20 | 21 | version=$(grep "^version" "${source_dir}/Cargo.toml" | \ 22 | head -n1 | \ 23 | grep -o "[0-9.]*") 24 | git tag -a -m "Release ${version}!!!" ${version} 25 | git push origin ${version} 26 | -------------------------------------------------------------------------------- /dev/release/verify-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eux 18 | 19 | if [ $# -lt 1 ]; then 20 | echo "Usage: $0 rc" 21 | echo " $0 staging-rc" 22 | echo " $0 release" 23 | echo " $0 staging-release" 24 | echo " e.g.: $0 rc # Verify RC packages" 25 | echo " e.g.: $0 staging-rc # Verify RC packages on staging" 26 | echo " e.g.: $0 release # Verify release packages" 27 | echo " e.g.: $0 staging-release # Verify release packages on staging" 28 | exit 1 29 | fi 30 | 31 | verify_type="$1" 32 | 33 | source_dir="$(dirname "$0")/../.." 34 | 35 | pushd "${source_dir}" 36 | for dir in package/{apt,yum}/*; do 37 | if [ ! -d "${dir}" ]; then 38 | continue 39 | fi 40 | base_name=${dir##*/} 41 | distribution= 42 | code_name= 43 | case ${base_name} in 44 | *-aarch64|*-arm64) 45 | ;; 46 | almalinux-*|debian-*|ubuntu-*) 47 | distribution=${base_name%-*} 48 | code_name=${base_name#*-} 49 | ;; 50 | esac 51 | if [ "${distribution}" = "" -o "#{code_name}" = "" ]; then 52 | continue 53 | fi 54 | package_type=$(basename "$(dirname "${dir}")") 55 | docker run \ 56 | --rm \ 57 | --volume "$PWD:/host" \ 58 | -it \ 59 | ${distribution}:${code_name} \ 60 | /host/package/${package_type}/test.sh \ 61 | "${verify_type}" 62 | done 63 | popd 64 | -------------------------------------------------------------------------------- /doc/Doxyfile.in: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | DOXYFILE_ENCODING = UTF-8 16 | EXTENSION_MAPPING = h=C 17 | GENERATE_HTML = NO 18 | GENERATE_LATEX = NO 19 | GENERATE_LEGEND = NO 20 | GENERATE_XML = YES 21 | OPTIMIZE_OUTPUT_FOR_C = YES 22 | INPUT = @DATAFUSION_H@ 23 | PROJECT_NAME = "DataFusion C" 24 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Minimal makefile for Sphinx documentation 16 | # 17 | 18 | # You can set these variables from the command line, and also 19 | # from the environment for the first two. 20 | SPHINXOPTS ?= -j auto 21 | SPHINXBUILD ?= sphinx-build 22 | SOURCEDIR = source 23 | BUILDDIR = build 24 | 25 | # Put it first so that "make" without argument is like "make help". 26 | # $(O) is meant as a shortcut for $(SPHINXOPTS). 27 | help: 28 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 29 | 30 | html: 31 | @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 32 | 33 | .PHONY: help html 34 | 35 | -------------------------------------------------------------------------------- /doc/build.py: -------------------------------------------------------------------------------- 1 | #!#/usr/bin/env python3 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import argparse 18 | import os 19 | import pathlib 20 | import shutil 21 | import subprocess 22 | 23 | parser = argparse.ArgumentParser(description='Build documents') 24 | parser.add_argument('--source-root', 25 | action='store', 26 | dest='source_root', 27 | help='Source root directory', 28 | metavar='PATH', 29 | required=True) 30 | parser.add_argument('--build-root', 31 | action='store', 32 | dest='build_root', 33 | help='Build root directory', 34 | metavar='PATH', 35 | required=True) 36 | parser.add_argument('--arrow-glib-gir-dir', 37 | action='store', 38 | dest='arrow_glib_gir_dir', 39 | help='Path where Arrow-*.gir exists', 40 | metavar='PATH', 41 | required=True) 42 | parser.add_argument('--source-reference', 43 | action='store', 44 | dest='source_reference', 45 | help='Branch or tag name for the target source', 46 | metavar='REFERENCE', 47 | required=True) 48 | args = parser.parse_args() 49 | source_root = pathlib.Path(args.source_root).resolve() 50 | build_root = pathlib.Path(args.build_root).resolve() 51 | arrow_glib_gir_dir = pathlib.Path(args.arrow_glib_gir_dir).resolve() 52 | source_reference = args.source_reference 53 | 54 | datafusion_gir = next((build_root / 'datafusion-glib').glob('DataFusion-*.gir')) 55 | build_doc_dir = build_root / 'doc' 56 | gi_docgen_config = build_doc_dir / 'glib' / 'gi-docgen.toml' 57 | html_dir = build_doc_dir / 'html' 58 | sphinx_build_dir = build_doc_dir / 'build' 59 | 60 | subprocess.run('doxygen', cwd=build_doc_dir, check=True) 61 | 62 | sphinx_env = os.environ.copy() 63 | sphinx_env['DOXYGEN_XML_DIR'] = str(build_doc_dir / 'xml') 64 | sphinx_env['SWITCHER_VERSION'] = source_reference 65 | subprocess.run(['make', 66 | '-f' + str(source_root / 'doc' / 'Makefile'), 67 | 'SOURCEDIR=' + str(source_root / 'doc' / 'source'), 68 | f'BUILDDIR={sphinx_build_dir}', 69 | 'html'], 70 | env=sphinx_env, 71 | check=True) 72 | 73 | shutil.rmtree(html_dir, ignore_errors=True) 74 | shutil.copytree(sphinx_build_dir / 'html', html_dir) 75 | 76 | subprocess.run(['gi-docgen', 77 | 'generate', 78 | f'--add-include-path={arrow_glib_gir_dir}', 79 | f'--config={gi_docgen_config}', 80 | f'--output-dir={html_dir}/glib', 81 | '--no-namespace-dir', 82 | datafusion_gir], 83 | check=True) 84 | subprocess.run(['gi-docgen', 85 | 'gen-index', 86 | f'--add-include-path={arrow_glib_gir_dir}', 87 | f'--config={gi_docgen_config}', 88 | f'--output-dir={html_dir}/glib', 89 | datafusion_gir], 90 | check=True) 91 | -------------------------------------------------------------------------------- /doc/glib/datafusion-glib-docs.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | %gtkdocentities; 23 | ]> 24 | 25 | 26 | &package_name; Reference Manual 27 | 28 | for &package_string;. 29 | 30 | 31 | 32 | 33 | Core 34 | 35 | Processing 36 | 37 | 38 | 39 | 40 | 41 | 42 | Error 43 | 44 | 45 | 46 | 47 | 48 | Object Hierarchy 49 | 50 | 51 | 52 | API Index 53 | 54 | 55 | 56 | Index of deprecated API 57 | 58 | 59 | 60 | Index of new symbols in 8.0.0 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/glib/entities.xml.in: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doc/glib/gi-docgen.toml.in: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [library] 16 | name = "DataFusion GLib" 17 | version = "@VERSION@" 18 | browse_url = "https://github.com/datafusion-contrib/datafusion-c/tree/@SOURCE_REFERENCE@" 19 | repository_url = "https://github.com/datafusion-contrib/datafusion-c.git" 20 | website_url = "https://datafusion-contrib.github.io/datafusion-c/" 21 | authors = "Sutou Kouhei" 22 | license = "Apache-2.0" 23 | description = "DataFusion GLib API" 24 | dependencies = ["GObject-2.0", "Arrow-1.0"] 25 | search_index = true 26 | 27 | [dependencies."GObject-2.0"] 28 | name = "GObject" 29 | description = "The base type system library" 30 | docs_url = "https://docs.gtk.org/gobject/" 31 | 32 | [dependencies."Arrow-1.0"] 33 | name = "Arrow" 34 | description = "Apache Arrow GLib API" 35 | docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" 36 | 37 | [related."datafusion-c"] 38 | name = "DataFusion C" 39 | description = "DataFusion C API" 40 | docs_url = "https://datafusion-contrib.github.io/datafusion-c/@SOURCE_REFERENCE@/" 41 | 42 | [source-location] 43 | base_url = "https://github.com/datafusion-contrib/datafusion-c/blob/@SOURCE_REFERENCE@" 44 | -------------------------------------------------------------------------------- /doc/glib/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | package_id = 'datafusion-glib' 16 | package_name = 'DataFusion GLib' 17 | entities_conf = configuration_data() 18 | entities_conf.set('PACKAGE', package_id) 19 | entities_conf.set('PACKAGE_BUGREPORT', 20 | 'https://github.com/datafusion-contrib/datafusion-c/issues') 21 | entities_conf.set('PACKAGE_NAME', package_name) 22 | entities_conf.set('PACKAGE_STRING', 23 | ' '.join([package_name, version])) 24 | entities_conf.set('PACKAGE_URL', 25 | 'https://github.com/datafusion-contrib/datafusion-c') 26 | entities_conf.set('PACKAGE_VERSION', version) 27 | configure_file(input: 'entities.xml.in', 28 | output: 'entities.xml', 29 | configuration: entities_conf) 30 | 31 | gi_docgen_toml_conf = configuration_data() 32 | gi_docgen_toml_conf.set('SOURCE_REFERENCE', source_reference) 33 | gi_docgen_toml_conf.set('VERSION', meson.project_version()) 34 | gi_docgen_toml = configure_file(input: 'gi-docgen.toml.in', 35 | output: 'gi-docgen.toml', 36 | configuration: gi_docgen_toml_conf) 37 | 38 | glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') 39 | glib_doc_path = glib_prefix / 'share' / 'gtk-doc' / 'html' 40 | arrow_glib_prefix = dependency('arrow-glib').get_pkgconfig_variable('prefix') 41 | arrow_glib_doc_path = arrow_glib_prefix / 'share' / 'gtk-doc' / 'html' 42 | doc_path = data_dir / 'gtk-doc' / 'html' / package_id 43 | 44 | dependencies = [ 45 | datafusion_glib, 46 | ] 47 | html_images = [] 48 | ignore_headers = [ 49 | meson.source_root() / 'datafusion-glib' / 'csv-read-options-raw.h', 50 | meson.source_root() / 'datafusion-glib' / 'data-frame-raw.h', 51 | meson.source_root() / 'datafusion-glib' / 'session-context-raw.h', 52 | ] 53 | source_directories = [ 54 | meson.source_root() / package_id, 55 | meson.build_root() / package_id, 56 | ] 57 | gnome.gtkdoc(package_id, 58 | dependencies: dependencies, 59 | fixxref_args: [ 60 | '--html-dir=' + doc_path, 61 | '--extra-dir=' + (glib_doc_path / 'glib'), 62 | '--extra-dir=' + (glib_doc_path / 'gobject'), 63 | '--extra-dir=' + (arrow_glib_doc_path / 'arrow-glib'), 64 | ], 65 | gobject_typesfile: package_id + '.types', 66 | html_assets: html_images, 67 | ignore_headers: ignore_headers, 68 | install: true, 69 | main_xml: package_id + '-docs.xml', 70 | mkdb_args: [ 71 | '--output-format=xml', 72 | '--name-space=gdf', 73 | '--source-suffixes=c,h', 74 | ], 75 | scan_args: [ 76 | '--rebuild-types', 77 | '--deprecated-guards=GDF_DISABLE_DEPRECATED', 78 | ], 79 | src_dir: source_directories) 80 | -------------------------------------------------------------------------------- /doc/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | subdir('glib') 16 | 17 | doxyfile_conf = configuration_data() 18 | doxyfile_conf.set('DATAFUSION_H', datafusion_h.full_path()) 19 | doxyfile = configure_file(input: 'Doxyfile.in', 20 | output: 'Doxyfile', 21 | configuration: doxyfile_conf) 22 | 23 | depend_files = files( 24 | '..' / 'cbindgen.toml', 25 | 'source' / 'conf.py', 26 | 'source' / 'example' / 'sql.rst', 27 | 'source' / 'glib-api.rst', 28 | 'source' / 'index.rst', 29 | 'source' / 'install.rst', 30 | 'source' / 'introduction.rst', 31 | 'source' / 'news' / '10.0.0.md', 32 | 'source' / 'news' / '21.0.0.md', 33 | 'source' / 'news.rst', 34 | 'source' / 'raw-c-api.rst', 35 | ) 36 | depend_files += [ 37 | doxyfile, 38 | gi_docgen_toml, 39 | ] 40 | 41 | custom_target('html', 42 | command: [ 43 | find_program('python3'), 44 | '@INPUT0@', 45 | '--source-root=@SOURCE_ROOT@', 46 | '--build-root=@BUILD_ROOT@', 47 | '--arrow-glib-gir-dir=' + arrow_glib.get_pkgconfig_variable('girdir'), 48 | '--source-reference=' + source_reference, 49 | ], 50 | depend_files: depend_files, 51 | depends: [datafusion_glib_gir], 52 | input: ['build.py'], 53 | output: ['html']) 54 | -------------------------------------------------------------------------------- /doc/source/_static/switcher.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "main", 4 | "url": "https://datafusion-contrib.github.io/datafusion-c/main/", 5 | "version": "main" 6 | }, 7 | { 8 | "name": "10.0.0 (latest)", 9 | "url": "https://datafusion-contrib.github.io/datafusion-c/latest/", 10 | "version": "10.0.0" 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /doc/source/conf.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import datetime 16 | import os 17 | import re 18 | 19 | project = 'DataFusion C' 20 | copyright = f'2022-{datetime.date.today().year}, Sutou Kouhei' 21 | author = 'Sutou Kouhei' 22 | with open(f'{os.path.dirname(__file__)}/../../Cargo.toml') as cargo_toml: 23 | version_re = re.compile('^version = "(.+?)"', re.MULTILINE) 24 | version = version_re.search(cargo_toml.read()).group(1) 25 | release = version 26 | 27 | extensions = [ 28 | 'breathe', 29 | 'myst_parser', 30 | ] 31 | source_suffix = { 32 | '.rst': 'restructuredtext', 33 | '.md': 'markdown', 34 | } 35 | 36 | breathe_default_project = 'datafusion-c' 37 | breathe_domain_by_extension = {'h' : 'c'} 38 | breathe_projects = {'datafusion-c': os.environ.get('DOXYGEN_XML_DIR', '../xml')} 39 | 40 | templates_path = ['_templates'] 41 | exclude_patterns = [] 42 | 43 | html_context = { 44 | 'github_user': 'datafusion-contrib', 45 | 'github_repo': 'datafusion-c', 46 | 'github_version': 'main', 47 | 'doc_path': 'doc/source', 48 | } 49 | html_theme = 'pydata_sphinx_theme' 50 | html_theme_options = { 51 | 'github_url': 'https://github.com/datafusion-contrib/datafusion-c', 52 | 'navbar_start': [ 53 | 'navbar-logo', 54 | 'version-switcher', 55 | ], 56 | 'navbar_center': [], 57 | 'switcher': { 58 | # 'json_url': '/_static/switcher.json', 59 | 'json_url': 'https://datafusion-contrib.github.io/datafusion-c/latest/_static/switcher.json', 60 | 'version_match': os.environ.get('SWITCHER_VERSION', version), 61 | }, 62 | "use_edit_page_button": True, 63 | } 64 | html_sidebars = { 65 | '**': [ 66 | 'search-field', 67 | 'navbar-nav', 68 | 'sidebar-nav-bs', 69 | ], 70 | } 71 | html_static_path = ['_static'] 72 | -------------------------------------------------------------------------------- /doc/source/developer.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Developer 15 | ========= 16 | 17 | .. toctree:: 18 | 19 | developer/release 20 | -------------------------------------------------------------------------------- /doc/source/developer/release.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Release 15 | ======= 16 | 17 | This document describes how to release a new version. 18 | 19 | Prepare 20 | ------- 21 | 22 | 1. Run ``dev/release/prepare.sh`` to create a branch for a new version 23 | and prepare the branch. 24 | 2. Update ``doc/source/news/${VERSION}.md``. 25 | 3. Commit changes. 26 | 4. Push the commit. 27 | 5. Open a pull request. 28 | 29 | Here are command lines for them: 30 | 31 | .. code-block:: console 32 | 33 | $ dev/release/prepare.sh ${VERSION} 34 | $ editor doc/source/news/${VERSION}.md 35 | $ git add doc/source/news/${VERSION}.md 36 | $ git commit 37 | $ git push 38 | 39 | Create a pull request for the branch on 40 | https://github.com/datafusion-contrib/datafusion-c/pulls . 41 | 42 | Tag and upload 43 | -------------- 44 | 45 | We can tag after we merge the prepare branch: 46 | 47 | .. code-block:: console 48 | 49 | $ dev/release/tag.sh 50 | 51 | Our CI jobs create ``.deb`` / ``.rpm`` packages automatically when we 52 | tag a new version. It takes about 20min. We need to wait for finishing 53 | these jobs. 54 | 55 | We can download the built ``.deb`` / ``.rpm`` packages and upload to 56 | https://apache.jfrog.io/artifactory/arrow/ after these jobs are 57 | finished. Note that this must be done by an Apache Arrow PMC member 58 | who registers his/her GPG key to 59 | https://dist.apache.org/repos/dist/release/arrow/KEYS . Because 60 | APT/Yum repositories at https://apache.jfrog.io/artifactory/arrow/ are 61 | for Apache Arrow. We just reuse these APT/Yum repositories. So we must 62 | follow policy of https://apache.jfrog.io/artifactory/arrow/ . 63 | 64 | .. seealso:: 65 | 66 | `Release Management Guide for Apache Arrow `__. 67 | 68 | .. code-block:: console 69 | 70 | $ rake -C package apt:rc yum:rc 71 | $ dev/package/verify-packages.sh rc 72 | $ rake -C package apt:release yum:release 73 | $ dev/package/verify-packages.sh release 74 | 75 | .. _apache-arrow-release: https://arrow.apache.org/docs/developers/release.html 76 | -------------------------------------------------------------------------------- /doc/source/example/sql.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Example - SQL 15 | ============= 16 | 17 | This section shows examples that execute a simple SQL in 18 | multiple ways. 19 | 20 | .. _example-sql-raw-c-api-from-c: 21 | 22 | Raw C API from C 23 | ---------------- 24 | 25 | The following code shows how to execute a simple SQL with raw C API 26 | in C. Here are points: 27 | 28 | * You can create a session context (:c:struct:`DFSessionContext`) by 29 | :c:func:`df_session_context_new()`. 30 | * You can run a SQL by :c:func:`df_session_context_sql()`. 31 | * You can get details on error by :c:struct:`DFError`. See also 32 | :c:func:`df_error_get_code()` and :c:func:`df_error_get_message()`. 33 | * You need to free :c:struct:`DFError` by :c:func:`df_error_free()` 34 | when no longer needed. 35 | * You can get :c:struct:`DFDataFrame` as a result of the SQL execution. 36 | * You can show :c:struct:`DFDataFrame` contents by 37 | :c:func:`df_data_frame_show()`. 38 | * You can free :c:struct:`DFDataFrame` by 39 | :c:func:`df_data_frame_free()`. 40 | * You can free :c:struct:`DFSessionContext` by 41 | :c:func:`df_session_context_free()`. 42 | 43 | .. literalinclude:: ../../../example/sql.c 44 | :language: c 45 | :linenos: 46 | 47 | .. _example-sql-glib-api-from-c: 48 | 49 | GLib API from C 50 | --------------- 51 | 52 | The following code shows how to execute a simple SQL with GLib API 53 | in C. Here are points: 54 | 55 | * You can create a session context (`GDFSessionContext`_) by 56 | `gdf_session_context_new()`_. 57 | * You can run a SQL by `gdf_session_context_sql()`_. 58 | * You can handle error the usual way in GLib. See `GError`_. 59 | * You can get `GDFDataFrame`_ as a result of the SQL execution. 60 | * You can show `GDFDataFrame`_ contents by 61 | `gdf_data_frame_show()`_. 62 | * You can free all `GObject`_ based objects such as 63 | `GDFSessionContext`_ and `GDFDataFrame`_ by `g_object_unref()`_. 64 | 65 | .. literalinclude:: ../../../example/sql-glib.c 66 | :language: c 67 | :linenos: 68 | 69 | .. _example-sql-raw-c-api-from-python: 70 | 71 | Raw C API from Python 72 | --------------------- 73 | 74 | The following code shows how to execute a simple SQL with raw C 75 | API in Python. You can use a FFI library such as `ctypes 76 | `__ to use raw C API from Python. Here are points: 77 | 78 | * You need to open DataFusion C's shared library explicitly but shared 79 | library name depends on platform. For example, it's 80 | ``libdatafusion.so`` on Linux. ``ctypes.util.find_library()`` may help you. 81 | * You need to open DataFusion C's shared library by ``ctypes.CDLL()``. 82 | * You need to prepare signature of raw C API's functions that you need 83 | to use before you call them. 84 | * See :ref:`example-sql-raw-c-api-from-c` how to use raw C API. 85 | 86 | .. literalinclude:: ../../../example/sql.py 87 | :language: python 88 | :linenos: 89 | 90 | .. _example-sql-glib-api-from-python: 91 | 92 | GLib API from Python 93 | -------------------- 94 | 95 | The following code shows how to execute a simple SQL with GLib API in 96 | Python. You can use `PyGObject`_ to use GLib API from Python. Here are 97 | points: 98 | 99 | * You can use ``DataFusion`` as GObject Introspection namespace. 100 | * See :ref:`example-sql-glib-api-from-c` how to use GLib API. 101 | 102 | .. literalinclude:: ../../../example/sql-glib.py 103 | :language: python 104 | :linenos: 105 | 106 | .. _example-sql-raw-c-api-from-ruby: 107 | 108 | Raw C API from Ruby 109 | ------------------- 110 | 111 | The following code shows how to execute a simple SQL with raw C 112 | API in Ruby. You can use a FFI library such as `Fiddle 113 | `__ to use raw C API from Ruby. Here are points: 114 | 115 | * You need to open DataFusion C's shared library explicitly but shared 116 | library name depends on platform. For example, it's 117 | ``libdatafusion.so`` on Linux. ``RbConfig::CONFIG["SOEXT"]`` may 118 | help you. 119 | * You need to open DataFusion C's shared library by 120 | ``Fiddle::Importer.dlload``. 121 | * You need to register raw C API's functions that you need 122 | to use explicitly before you call them. 123 | * See :ref:`example-sql-raw-c-api-from-c` how to use raw C API. 124 | 125 | .. literalinclude:: ../../../example/sql.rb 126 | :language: ruby 127 | :linenos: 128 | 129 | .. _example-sql-glib-api-from-ruby: 130 | 131 | GLib API from Ruby 132 | ------------------ 133 | 134 | The following code shows how to execute a simple SQL with GLib API in 135 | Ruby. You can use `gobject-introspection gem 136 | `__ or `red-datafusion gem 137 | `__ to use GLib API from Ruby. The following 138 | example uses gobject-introspection gem but you should use 139 | red-datafusion gem in production. red-datafusion gem is built on top 140 | of the gobject-introspection gem and adds many useful APIs. Here are 141 | points: 142 | 143 | * You can use ``DataFusion`` as GObject Introspection namespace. 144 | * See :ref:`example-sql-glib-api-from-c` how to use GLib API. 145 | 146 | .. literalinclude:: ../../../example/sql-glib.rb 147 | :language: ruby 148 | :linenos: 149 | 150 | GLib API from Vala 151 | ------------------ 152 | 153 | The following code shows how to execute a simple SQL with GLib API in 154 | Vala. You need to add ``-Dvapi=true`` when you run ``meson setup`` to 155 | enable Vala support. Here are points: 156 | 157 | * You can use ``datafusion-glib`` as Vala package name. 158 | * You can get a directory where Vala API file for ``datafusion-glib`` 159 | package exists by ``pkg-config --variable=vapidir datafusion-glib``. 160 | * See :ref:`example-sql-glib-api-from-c` how to use GLib API. 161 | 162 | .. literalinclude:: ../../../example/sql-glib.vala 163 | :language: vala 164 | :linenos: 165 | 166 | .. _GDFDataFrame: ../glib/class.DataFrame.html 167 | .. _GDFSessionContext: ../glib/class.SessionContext.html 168 | .. _GError: https://docs.gtk.org/glib/struct.Error.html 169 | .. _GObject: https://docs.gtk.org/gobject/class.Object.html 170 | .. _PyGObject: https://pygobject.readthedocs.io/en/latest/ 171 | .. _ctypes: https://docs.python.org/3/library/ctypes.html 172 | .. _fiddle: https://github.com/ruby/fiddle 173 | .. _g_object_unref(): https://docs.gtk.org/gobject/method.Object.unref.html 174 | .. _gdf_data_frame_show(): ../glib/method.DataFrame.show.html 175 | .. _gdf_session_context_new(): ../glib/ctor.SessionContext.new.html 176 | .. _gdf_session_context_sql(): ../glib/method.SessionContext.sql.html 177 | .. _gobject-introspection-gem: https://rubygems.org/gems/gobject-introspection 178 | .. _red-datafusion-gem: https://rubygems.org/gems/red-datafusion 179 | -------------------------------------------------------------------------------- /doc/source/glib-api.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | GLib API 15 | ======== 16 | 17 | DataFusion C also provides GLib API. 18 | 19 | See `DataFusion GLib's API reference `__ for details. 20 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | DataFusion C 15 | ============ 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | :caption: Contents: 20 | 21 | introduction 22 | install 23 | example/sql 24 | raw-c-api 25 | glib-api 26 | developer 27 | news 28 | 29 | Indices and tables 30 | ================== 31 | 32 | * :ref:`genindex` 33 | * :ref:`modindex` 34 | * :ref:`search` 35 | -------------------------------------------------------------------------------- /doc/source/install.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Install 15 | ======= 16 | 17 | We provide binary packages for some platforms. If your platform isn't 18 | included these platforms, you need to build by yourself. 19 | 20 | Debian GNU/Linux and Ubuntu 21 | --------------------------- 22 | 23 | Here are supported versions: 24 | 25 | * Debian GNU/Linux bullseye 26 | * Debian GNU/Linux bookworm 27 | * Ubuntu 20.04 LTS 28 | * Ubuntu 22.04 LTS 29 | 30 | .. code-block:: console 31 | 32 | $ sudo apt update 33 | $ sudo apt install -y -V ca-certificates lsb-release wget 34 | $ wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 35 | $ sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb 36 | $ sudo apt update 37 | $ sudo apt install -y -V libdatafusion-dev # For C 38 | $ sudo apt install -y -V libdatafusion-glib-dev # For GLib 39 | 40 | AlmaLinux 8 and Red Hat Enterprise Linux 8 41 | ------------------------------------------ 42 | 43 | .. code-block:: console 44 | 45 | $ sudo dnf install -y epel-release || sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1).noarch.rpm 46 | $ sudo dnf install -y https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm 47 | $ sudo dnf config-manager --set-enabled epel || : 48 | $ sudo dnf config-manager --set-enabled powertools || : 49 | $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-rhui-rpms || : 50 | $ sudo subscription-manager repos --enable codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-$(arch)-rpms || : 51 | $ sudo dnf install -y datafusion-devel # For C 52 | $ sudo dnf install -y datafusion-glib-devel # For GLib 53 | 54 | AlmaLinux 9 and Red Hat Enterprise Linux 9 55 | ------------------------------------------ 56 | 57 | .. code-block:: console 58 | 59 | $ sudo dnf install -y epel-release || sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1).noarch.rpm 60 | $ sudo dnf install -y https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm 61 | $ sudo dnf config-manager --set-enabled epel || : 62 | $ sudo dnf config-manager --set-enabled crb || : 63 | $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-rhui-rpms || : 64 | $ sudo subscription-manager repos --enable codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-$(arch)-rpms || : 65 | $ sudo dnf install -y datafusion-devel # For C 66 | $ sudo dnf install -y datafusion-glib-devel # For GLib 67 | 68 | Build from source 69 | ----------------- 70 | 71 | If you don't need GLib API, you can use `Cargo `__ based 72 | install instruction: 73 | 74 | .. code-block:: console 75 | 76 | $ cargo install cargo-c 77 | $ cargo cbuild 78 | $ cargo cinstall 79 | 80 | See `the cargo-c's document `__ for more build and install 81 | options. 82 | 83 | If you need GLib API, you need both of `Cargo `_ and 84 | `Meson `_. 85 | 86 | .. code-block:: console 87 | 88 | $ cargo install cargo-c 89 | $ meson setup build . 90 | $ meson install -C build 91 | 92 | See `the Meson's Built-in options document 93 | `__ for more setup options. Especially, you 94 | need to know the ``--prefix`` option. 95 | 96 | Here are DataFusion GLib specific options: 97 | 98 | .. list-table:: DataFusion GLib specific options 99 | :header-rows: 1 100 | 101 | * - Syntax 102 | - Description 103 | - Default 104 | * - ``-Ddoc=BOOLEAN`` 105 | - Whether document is built by `GTK-Doc `__ or not. 106 | - ``false`` 107 | * - ``-Dvapi=BOOLEAN`` 108 | - Whether `Vala `__ support is built by or not. 109 | - ``false`` 110 | 111 | .. _cargo-c: https://github.com/lu-zero/cargo-c 112 | .. _cargo: https://doc.rust-lang.org/cargo/ 113 | .. _gtk-doc: https://developer-old.gnome.org/gtk-doc-manual/stable/ 114 | .. _meson-built-in-options: https://mesonbuild.com/Builtin-options.html 115 | .. _meson: https://mesonbuild.com/ 116 | .. _vala: https://vala.dev/ 117 | -------------------------------------------------------------------------------- /doc/source/introduction.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Introduction 15 | ============ 16 | 17 | DataFusion C provides C API for `DataFusion `_ that is an 18 | extensible query execution framework written in Rust. C API is useful 19 | to use DataFusion from other languages. 20 | 21 | APIs 22 | ---- 23 | 24 | DataFusion C provides 2 APIs: 25 | 26 | * Raw C API 27 | * `GLib `__ API built on top of raw C API 28 | 29 | If you already use GLib, GLib API is better. If you don't use GLib, 30 | raw C API is enough. 31 | 32 | .. _datafusion: https://arrow.apache.org/datafusion/ 33 | .. _glib: https://docs.gtk.org/glib/ 34 | -------------------------------------------------------------------------------- /doc/source/news.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022-2023 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | News 15 | ==== 16 | 17 | .. toctree:: 18 | 19 | news/21.0.0 20 | news/10.0.0 21 | -------------------------------------------------------------------------------- /doc/source/news/10.0.0.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # 10.0.0 - 2022-08-22 18 | 19 | Initial release!!! 20 | -------------------------------------------------------------------------------- /doc/source/news/21.0.0.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # 21.0.0 - 2023-04-03 18 | 19 | ## Improvements 20 | 21 | - #37: Upgraded based Apache DataFusion to 21.0.0. 22 | 23 | - #46: Added support for writing a data frame as Apache Parquet format. 24 | -------------------------------------------------------------------------------- /doc/source/raw-c-api.rst: -------------------------------------------------------------------------------- 1 | .. Copyright 2022 Sutou Kouhei 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | 14 | Raw C API 15 | ========= 16 | 17 | .. doxygenindex:: 18 | :project:datafusion-c 19 | -------------------------------------------------------------------------------- /example/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | executable('sql-c', 'sql.c', 16 | dependencies: [datafusion]) 17 | executable('sql-glib-c', 'sql-glib.c', 18 | dependencies: [datafusion_glib], 19 | include_directories: include_directories('..')) 20 | 21 | if generate_vapi 22 | vala_example_executable_kwargs = { 23 | 'c_args': [ 24 | '-I' + meson.build_root(), 25 | '-I' + meson.source_root(), 26 | ], 27 | 'dependencies': [ 28 | datafusion_glib_vapi, 29 | arrow_glib, 30 | gobject, 31 | ], 32 | 'vala_args': [ 33 | '--pkg', 'posix', 34 | '--vapidir', arrow_glib.get_variable('vapidir'), 35 | ], 36 | } 37 | executable('sql-glib-vala', 'sql-glib.vala', 38 | kwargs: vala_example_executable_kwargs) 39 | endif 40 | 41 | install_data('sql.c', 42 | 'sql.py', 43 | 'sql.rb', 44 | install_dir: data_dir / 'datafusion' / 'example') 45 | 46 | install_data('sql-glib.c', 47 | 'sql-glib.py', 48 | 'sql-glib.rb', 49 | 'sql-glib.vala', 50 | install_dir: data_dir / 'datafusion-glib' / 'example') 51 | -------------------------------------------------------------------------------- /example/sql-glib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | */ 15 | 16 | /* 17 | * How to build: 18 | * $ cc -o sql-glib sql-glib.c $(pkg-config --cflags --libs datafusion-glib) 19 | * 20 | * How to run: 21 | * $ ./sql-glib 22 | * +----------+ 23 | * | Int64(1) | 24 | * +----------+ 25 | * | 1 | 26 | * +----------+ 27 | */ 28 | 29 | #include 30 | 31 | #include 32 | 33 | int 34 | main(void) 35 | { 36 | GDFSessionContext *context = gdf_session_context_new(); 37 | GError *error = NULL; 38 | GDFDataFrame *data_frame = gdf_session_context_sql(context, 39 | "SELECT 1;", 40 | &error); 41 | if (error) { 42 | g_print("failed to run SQL: %s\n", error->message); 43 | g_error_free(error); 44 | g_object_unref(context); 45 | return EXIT_FAILURE; 46 | } 47 | gdf_data_frame_show(data_frame, &error); 48 | if (error) { 49 | g_print("failed to show data frame: %s\n", error->message); 50 | g_error_free(error); 51 | } 52 | g_object_unref(data_frame); 53 | g_object_unref(context); 54 | return EXIT_SUCCESS; 55 | } 56 | -------------------------------------------------------------------------------- /example/sql-glib.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # How to run: 18 | # $ ./sql-glib.py 19 | # +----------+ 20 | # | Int64(1) | 21 | # +----------+ 22 | # | 1 | 23 | # +----------+ 24 | 25 | import gi 26 | from gi.repository import DataFusion 27 | 28 | context = DataFusion.SessionContext.new() 29 | data_frame = context.sql("SELECT 1;", ) 30 | data_frame.show() 31 | -------------------------------------------------------------------------------- /example/sql-glib.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # How to run: 18 | # $ ./sql-glib.rb 19 | # +----------+ 20 | # | Int64(1) | 21 | # +----------+ 22 | # | 1 | 23 | # +----------+ 24 | 25 | require "gi" 26 | 27 | DataFusion = GI.load("DataFusion") 28 | 29 | context = DataFusion::SessionContext.new 30 | data_frame = context.sql("SELECT 1;") 31 | data_frame.show 32 | -------------------------------------------------------------------------------- /example/sql-glib.vala: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Sutou Kouhei 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // How to build: 16 | // $ valac \ 17 | // --vapidir $(pkg-config --variable=vapidir datafusion-glib) \ 18 | // --pkg datafusion-glib \ 19 | // --pkg posix \ 20 | // sql-glib.vala 21 | // 22 | // How to run: 23 | // $ ./sql-glib 24 | // +----------+ 25 | // | Int64(1) | 26 | // +----------+ 27 | // | 1 | 28 | // +----------+ 29 | 30 | int main(string[] args) { 31 | var context = new GDF.SessionContext(); 32 | GDF.DataFrame data_frame; 33 | try { 34 | data_frame = context.sql("SELECT 1;"); 35 | } catch (Error error) { 36 | stderr.printf("failed to run SQL: %s\n", error.message); 37 | return Posix.EXIT_FAILURE; 38 | } 39 | try { 40 | data_frame.show(); 41 | } catch (Error error) { 42 | stderr.printf("failed to show data frame: %s\n", error.message); 43 | return Posix.EXIT_FAILURE; 44 | } 45 | return Posix.EXIT_SUCCESS; 46 | } 47 | -------------------------------------------------------------------------------- /example/sql.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Sutou Kouhei 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | */ 15 | 16 | /* 17 | * How to build: 18 | * $ cc -o sql sql.c $(pkg-config --cflags --libs datafusion) 19 | * 20 | * How to run: 21 | * $ ./sql 22 | * +----------+ 23 | * | Int64(1) | 24 | * +----------+ 25 | * | 1 | 26 | * +----------+ 27 | */ 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | int 35 | main(void) 36 | { 37 | DFSessionContext *context = df_session_context_new(); 38 | DFError *error = NULL; 39 | DFDataFrame *data_frame = df_session_context_sql(context, "SELECT 1;", &error); 40 | if (error) { 41 | printf("failed to run SQL: %s\n", df_error_get_message(error)); 42 | df_error_free(error); 43 | df_session_context_free(context); 44 | return EXIT_FAILURE; 45 | } 46 | df_data_frame_show(data_frame, &error); 47 | if (error) { 48 | printf("failed to show data frame: %s\n", df_error_get_message(error)); 49 | df_error_free(error); 50 | } 51 | df_data_frame_free(data_frame); 52 | df_session_context_free(context); 53 | return EXIT_SUCCESS; 54 | } 55 | -------------------------------------------------------------------------------- /example/sql.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # How to run: 18 | # $ ./sql.py 19 | # +----------+ 20 | # | Int64(1) | 21 | # +----------+ 22 | # | 1 | 23 | # +----------+ 24 | 25 | import ctypes 26 | import ctypes.util 27 | 28 | datafusion_so_path = ctypes.util.find_library('datafusion') 29 | if datafusion_so_path is None: 30 | import sys 31 | if sys.platform == 'darwin': 32 | datafusion_so_path = 'libdatafusion.dylib' 33 | elif sys.platform == 'win32': 34 | datafusion_so_path = 'datafusion.dll' 35 | else: 36 | datafusion_so_path = 'libdatafusion.so' 37 | datafusion = ctypes.CDLL(datafusion_so_path) 38 | 39 | datafusion.df_error_free.argtypes = [ctypes.c_void_p] 40 | datafusion.df_error_free.restype = None 41 | datafusion.df_error_get_message.argtypes = [ctypes.c_void_p] 42 | datafusion.df_error_get_message.restype = ctypes.c_char_p 43 | 44 | datafusion.df_session_context_new.argtypes = [] 45 | datafusion.df_session_context_new.restype = ctypes.c_void_p 46 | datafusion.df_session_context_free.argtypes = [ctypes.c_void_p] 47 | datafusion.df_session_context_free.restype = None 48 | datafusion.df_session_context_sql.argtypes = \ 49 | [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p] 50 | datafusion.df_session_context_sql.restype = ctypes.c_void_p 51 | 52 | datafusion.df_data_frame_free.argtypes = [ctypes.c_void_p] 53 | datafusion.df_data_frame_free.restype = None 54 | datafusion.df_data_frame_show.argtypes = [ctypes.c_void_p, ctypes.c_void_p] 55 | datafusion.df_data_frame_show.restype = None 56 | 57 | context = datafusion.df_session_context_new() 58 | try: 59 | error = (ctypes.c_void_p * 1)() 60 | try: 61 | data_frame = datafusion.df_session_context_sql( 62 | context, b'SELECT 1;', ctypes.pointer(error)) 63 | if error[0] is not None: 64 | message = datafusion.df_error_get_message(error[0]) 65 | print(f'failed to run SQL: {message.decode()}') 66 | exit(1) 67 | try: 68 | datafusion.df_data_frame_show(data_frame, ctypes.pointer(error)); 69 | if error[0] is not None: 70 | message = datafusion.df_error_get_message(error[0]) 71 | print('failed to show data frame: {message.decode()}') 72 | exit(1) 73 | finally: 74 | datafusion.df_data_frame_free(data_frame) 75 | finally: 76 | if error[0] is not None: 77 | datafusion.df_error_free(error[0]) 78 | finally: 79 | datafusion.df_session_context_free(context) 80 | -------------------------------------------------------------------------------- /example/sql.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # How to run: 18 | # $ ./sql.rb 19 | # +----------+ 20 | # | Int64(1) | 21 | # +----------+ 22 | # | 1 | 23 | # +----------+ 24 | 25 | require "rbconfig" 26 | require "fiddle/import" 27 | 28 | module DataFusion 29 | extend Fiddle::Importer 30 | 31 | ext = RbConfig::CONFIG["SOEXT"] 32 | if /mingw|mswin/.match?(RUBY_PLATFORM) 33 | prefix = "" 34 | else 35 | prefix = "lib" 36 | end 37 | dlload "#{prefix}datafusion.#{ext}" 38 | 39 | typealias "DFError *", "void *" 40 | extern "void df_error_free(DFError *error)" 41 | extern "const char *df_error_get_message(DFError *error)" 42 | 43 | typealias "DFDataFrame *", "void *" 44 | extern "void df_data_frame_free(DFDataFrame *data_frame)" 45 | extern "void df_data_frame_show(DFDataFrame *data_frame, DFError **error)" 46 | 47 | typealias "DFSessionContext *", "void *" 48 | extern "DFSessionContext *df_session_context_new(void)" 49 | extern "void df_session_context_free(DFSessionContext *ctx)" 50 | extern "DFDataFrame *df_session_context_sql(DFSessionContext *ctx, const char *sql, DFError **error)" 51 | end 52 | 53 | begin 54 | context = DataFusion.df_session_context_new 55 | Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP, Fiddle::RUBY_FREE) do |error| 56 | begin 57 | data_frame = DataFusion.df_session_context_sql(context, "SELECT 1;", error) 58 | unless error.ptr.null? 59 | message = DataFusion.df_error_get_message(error.ptr) 60 | puts("failed to run SQL: #{message}") 61 | exit(false) 62 | end 63 | begin 64 | DataFusion.df_data_frame_show(data_frame, error) 65 | unless error.ptr.null? 66 | message = DataFusion.df_error_get_message(error.ptr) 67 | puts("failed to show data frame: #{message}") 68 | exit(false) 69 | end 70 | ensure 71 | DataFusion.df_data_frame_free(data_frame) 72 | end 73 | ensure 74 | DataFusion.df_error_free(error.ptr) unless error.ptr.null? 75 | end 76 | end 77 | ensure 78 | DataFusion.df_session_context_free(context) 79 | end 80 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | project('datafusion-c', 'rust', 'c', 16 | default_options: [ 17 | 'c_std=c99', 18 | ], 19 | license: 'Apache-2.0', 20 | version: '21.0.0') 21 | 22 | version = meson.project_version() 23 | version_numbers = version.split('.') 24 | version_major = version_numbers[0].to_int() 25 | version_minor = version_numbers[1].to_int() 26 | version_micro = version_numbers[2].to_int() 27 | 28 | api_version = '@0@.@1@'.format(version_major, version_minor) 29 | so_version = '@0@'.format(version_major) 30 | library_version = version 31 | 32 | prefix = get_option('prefix') 33 | data_dir = get_option('datadir') 34 | include_dir = get_option('includedir') 35 | lib_dir = get_option('libdir') 36 | 37 | gir_dir = data_dir / 'gir-1.0' 38 | vapi_dir = data_dir / 'vala' / 'vapi' 39 | pkg_config_dir = lib_dir / 'pkgconfig' 40 | 41 | full_data_dir = prefix / data_dir 42 | full_include_dir = prefix / include_dir 43 | full_lib_dir = prefix / lib_dir 44 | full_pkg_config_dir = prefix / pkg_config_dir 45 | 46 | pkgconfig_variables = [ 47 | 'girdir=${prefix}/@0@'.format(gir_dir), 48 | 'vapidir=${prefix}/@0@'.format(vapi_dir), 49 | ] 50 | 51 | source_reference = get_option('source-reference') 52 | 53 | fs = import('fs') 54 | rustc_target_libdir = run_command(find_program('rustc'), '--print=target-libdir', 55 | capture: true, 56 | check: true) 57 | libdatafusion_output_base_dir = fs.name(fs.parent(rustc_target_libdir.stdout())) 58 | build_type = get_option('buildtype') 59 | if build_type == 'release' or build_type == 'debugoptimized' 60 | cargo_build_type = 'release' 61 | else 62 | cargo_build_type = 'debug' 63 | endif 64 | libdatafusion_output_dir = libdatafusion_output_base_dir / cargo_build_type 65 | if build_machine.system() == 'darwin' 66 | libdatafusion_so_path = 'libdatafusion.dylib' 67 | libdatafusion_so_install_dir = lib_dir 68 | elif build_machine.system() == 'windows' 69 | libdatafusion_so_path = 'datafusion.dll' 70 | libdatafusion_so_install_dir = lib_dir 71 | else 72 | libdatafusion_so_path = 'libdatafusion.so' 73 | libdatafusion_so_install_dir = false 74 | endif 75 | libdatafusion_output = [ 76 | libdatafusion_so_path, 77 | 'datafusion.h', 78 | 'datafusion.pc', 79 | libdatafusion_output_base_dir, 80 | ] 81 | libdatafusion_install_dir = [ 82 | libdatafusion_so_install_dir, 83 | include_dir, 84 | pkg_config_dir, 85 | false, 86 | ] 87 | if libdatafusion_so_path.endswith('.so') 88 | libdatafusion_so_version_path = \ 89 | '@0@.@1@'.format(libdatafusion_so_path, version) 90 | libdatafusion_so_version_major_path = \ 91 | '@0@.@1@'.format(libdatafusion_so_path, version_major) 92 | libdatafusion_output += [ 93 | libdatafusion_so_version_path, 94 | libdatafusion_so_version_major_path, 95 | ] 96 | libdatafusion_install_dir += [ 97 | lib_dir, 98 | false, 99 | ] 100 | install_symlink(libdatafusion_so_version_major_path, 101 | install_dir: lib_dir, 102 | pointing_to: libdatafusion_so_version_path) 103 | install_symlink(libdatafusion_so_path, 104 | install_dir: lib_dir, 105 | pointing_to: libdatafusion_so_version_major_path) 106 | cbuild_libdir = '${exec_prefix}' / lib_dir 107 | elif libdatafusion_so_path.endswith('.dylib') 108 | libdatafusion_so_base_path = fs.replace_suffix(libdatafusion_so_path, '') 109 | libdatafusion_so_version_major_path = \ 110 | '@0@.@1@.dylib'.format(libdatafusion_so_base_path, version_major) 111 | libdatafusion_output = [ 112 | libdatafusion_so_version_major_path, 113 | libdatafusion_output[1], 114 | libdatafusion_output[2], 115 | libdatafusion_output[3], 116 | libdatafusion_so_path, 117 | ] 118 | libdatafusion_install_dir += [ 119 | false, 120 | ] 121 | install_symlink(libdatafusion_so_path, 122 | install_dir: lib_dir, 123 | pointing_to: libdatafusion_so_version_major_path) 124 | cbuild_libdir = prefix / lib_dir 125 | else 126 | cbuild_libdir = prefix / lib_dir 127 | endif 128 | libdatafusion_command = [ 129 | find_program('python3'), 130 | '@CURRENT_SOURCE_DIR@' / 'build.py', 131 | '--file', libdatafusion_output_dir / 'datafusion.pc', 132 | '--file', libdatafusion_output_dir / 'include' / 'datafusion.h', 133 | '--shared-object', libdatafusion_output_dir / libdatafusion_so_path, 134 | '--version', version, 135 | '--', 136 | find_program('cargo'), 137 | 'cbuild', 138 | '--color', 'always', 139 | '--includedir', '${prefix}/@0@'.format(include_dir), 140 | '--libdir', cbuild_libdir, 141 | '--manifest-path', '@INPUT0@', 142 | '--prefix', prefix, 143 | '--target-dir','@OUTDIR@', 144 | ] 145 | if cargo_build_type == 'release' 146 | libdatafusion_command += ['--release'] 147 | endif 148 | libdatafusion = custom_target('libdatafusion', 149 | build_by_default: true, 150 | command: libdatafusion_command, 151 | input: [ 152 | 'Cargo.toml', 153 | 'src/capi.rs', 154 | 'src/lib.rs', 155 | ], 156 | install: true, 157 | install_dir: libdatafusion_install_dir, 158 | output: libdatafusion_output) 159 | libdatafusion_so = libdatafusion[0] 160 | datafusion_h = libdatafusion[1] 161 | datafusion_pc = libdatafusion[2] 162 | datafusion = declare_dependency(link_with: [libdatafusion_so], 163 | sources: [datafusion_h]) 164 | 165 | have_gi = dependency('gobject-introspection-1.0', required: false).found() 166 | arrow_glib = dependency('arrow-glib') 167 | generate_vapi = have_gi and get_option('vapi') 168 | if generate_vapi 169 | add_languages('vala') 170 | endif 171 | 172 | subdir('datafusion-glib') 173 | 174 | cmake = import('cmake') 175 | cmake_config = configuration_data() 176 | cmake_config.set('DEFAULT_LIBRARY', get_option('default_library')) 177 | cmake_config.set('INCLUDE_DIR', include_dir) 178 | cmake_config.set('LIB_DIR', lib_dir) 179 | cmake_config.set('PACKAGE_VERSION', version) 180 | cmake_config.set('PACKAGE_VERSION_MAJOR', version_major) 181 | cmake_config.set('PACKAGE_VERSION_MICRO', version_micro) 182 | cmake_config.set('PACKAGE_VERSION_MINOR', version_minor) 183 | cmake.write_basic_package_version_file(name: 'datafusion', version: version) 184 | cmake.configure_package_config_file(name: 'datafusion', 185 | input: 'datafusion-config.cmake.in', 186 | configuration: cmake_config) 187 | cmake.write_basic_package_version_file(name: 'datafusion-glib', version: version) 188 | cmake.configure_package_config_file(name: 'datafusion-glib', 189 | input: 'datafusion-glib-config.cmake.in', 190 | configuration: cmake_config) 191 | 192 | subdir('example') 193 | if get_option('doc') 194 | subdir('doc') 195 | endif 196 | 197 | test_run = find_program('test/run.sh') 198 | test('unit test', 199 | test_run, 200 | env: [ 201 | 'BUILD=no' 202 | ]) 203 | 204 | custom_target('format', 205 | command: [ 206 | find_program('cargo'), 207 | 'fmt', 208 | '--all', 209 | '--manifest-path', '@INPUT0@', 210 | ], 211 | input: ['Cargo.toml'], 212 | # This file never generated. We can use this as a Ninja target: 213 | # $ ninja format 214 | output: ['format']) 215 | 216 | custom_target('clippy', 217 | command: [ 218 | find_program('cargo'), 219 | 'clippy', 220 | '--all-features', 221 | '--all-targets', 222 | '--manifest-path', '@INPUT0@', 223 | '--', 224 | '-D', 'clippy::all', 225 | '-D', 'warnings', 226 | ], 227 | input: ['Cargo.toml'], 228 | # This file never generated. We can use this as a Ninja target: 229 | # $ ninja clippy 230 | output: ['clippy']) 231 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | option('doc', 16 | type: 'boolean', 17 | value: false, 18 | description: 'Build document') 19 | 20 | option('source-reference', 21 | type: 'string', 22 | value: 'main', 23 | description: 'Source reference (revision/branch/tag/...) to refer source URL in documents generated by GI-DocGen') 24 | 25 | option('vapi', 26 | type: 'boolean', 27 | value: false, 28 | description: 'Build Vala API') 29 | -------------------------------------------------------------------------------- /package/Rakefile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require "pathname" 16 | 17 | require_relative "../vendor/apache-arrow/dev/tasks/linux-packages/package-task" 18 | 19 | class DataFusionPackageTask < PackageTask 20 | def initialize 21 | super("datafusion-c", detect_version, detect_release_time) 22 | end 23 | 24 | def define 25 | super 26 | define_rc_tasks 27 | define_release_tasks 28 | end 29 | 30 | private 31 | def detect_version 32 | version_env = ENV["VERSION"] 33 | return version_env if version_env 34 | 35 | meson_build = top_source_dir / "meson.build" 36 | meson_build.read.scan(/version: '(.+?)'/)[0][0] 37 | end 38 | 39 | def detect_release_time 40 | release_time_env = ENV["RELEASE_TIME"] 41 | if release_time_env 42 | Time.parse(release_time_env).utc 43 | else 44 | Time.now.utc 45 | end 46 | end 47 | 48 | def top_source_dir 49 | Pathname(__dir__).parent 50 | end 51 | 52 | def define_archive_task 53 | file @archive_name do 54 | cd(top_source_dir) do 55 | sh("git", 56 | "archive", 57 | "HEAD", 58 | "--output", @full_archive_name, 59 | "--prefix", "#{@archive_base_name}/") 60 | end 61 | end 62 | end 63 | 64 | def apt_targets_default 65 | [ 66 | "debian-bullseye", 67 | # "debian-bullseye-arm64", 68 | "debian-bookworm", 69 | # "debian-bookworm-arm64", 70 | "ubuntu-focal", 71 | # "ubuntu-focal-arm64", 72 | "ubuntu-jammy", 73 | # "ubuntu-jammy-arm64", 74 | ] 75 | end 76 | 77 | def yum_targets_default 78 | [ 79 | "almalinux-8", 80 | # "almalinux-8-aarch64", 81 | "almalinux-9", 82 | # "almalinux-9-aarch64", 83 | ] 84 | end 85 | 86 | def built_package_url(target_namespace, target) 87 | github_repository = 88 | ENV["GITHUB_REPOSITORY"] || "datafusion-contrib/datafusion-c" 89 | url = "https://github.com/#{github_repository}" 90 | url << "/releases/download/#{@version}/" 91 | case target_namespace 92 | when :apt 93 | if target.end_with?("-arm64") 94 | url << "#{target}.tar.gz" 95 | else 96 | url << "#{target}-amd64.tar.gz" 97 | end 98 | when :yum 99 | if target.end_with?("-aarch64") 100 | url << "#{target}.tar.gz" 101 | else 102 | url << "#{target}-x86_64.tar.gz" 103 | end 104 | end 105 | url 106 | end 107 | 108 | def apache_arrow_dir 109 | "#{__dir__}/../vendor/apache-arrow" 110 | end 111 | 112 | def package_dir_name 113 | "#{@package}-#{@version}" 114 | end 115 | 116 | def download_packages(target_namespace) 117 | download_dir = "#{apache_arrow_dir}/packages/#{package_dir_name}" 118 | mkdir_p(download_dir) 119 | __send__("#{target_namespace}_targets").each do |target| 120 | url = built_package_url(target_namespace, target) 121 | archive = download(url, download_dir) 122 | cd(download_dir) do 123 | sh("tar", "xf", archive) 124 | end 125 | end 126 | end 127 | 128 | def upload_rc(target_namespace) 129 | targets = __send__("#{target_namespace}_targets") 130 | cd(apache_arrow_dir) do 131 | env = { 132 | "CROSSBOW_JOB_ID" => package_dir_name, 133 | "DEB_PACKAGE_NAME" => @package, 134 | "STAGING" => ENV["STAGING"] || "no", 135 | "UPLOAD_DEFAULT" => "0", 136 | } 137 | targets.each do |target| 138 | distribution = target.split("-")[0].upcase 139 | env["UPLOAD_#{distribution}"] = "1" 140 | end 141 | sh(env, 142 | "dev/release/05-binary-upload.sh", 143 | @version, 144 | "0") 145 | end 146 | end 147 | 148 | def define_rc_tasks 149 | [:apt, :yum].each do |target_namespace| 150 | tasks = [] 151 | namespace target_namespace do 152 | desc "Upload RC #{target_namespace} packages" 153 | task :rc do 154 | download_packages(target_namespace) 155 | upload_rc(target_namespace) 156 | end 157 | tasks << "#{target_namespace}:release" 158 | end 159 | task target_namespace => tasks 160 | end 161 | end 162 | 163 | def release(target_namespace) 164 | targets = __send__("#{target_namespace}_targets") 165 | cd(apache_arrow_dir) do 166 | env = { 167 | "STAGING" => ENV["STAGING"] || "no", 168 | "DEPLOY_DEFAULT" => "0", 169 | } 170 | targets.each do |target| 171 | distribution = target.split("-")[0].upcase 172 | env["DEPLOY_#{distribution}"] = "1" 173 | end 174 | sh(env, 175 | "dev/release/post-02-binary.sh", 176 | @version, 177 | "0") 178 | end 179 | end 180 | 181 | def define_release_tasks 182 | [:apt, :yum].each do |target_namespace| 183 | tasks = [] 184 | namespace target_namespace do 185 | desc "Release #{target_namespace} packages" 186 | task :release do 187 | release(target_namespace) 188 | end 189 | tasks << "#{target_namespace}:release" 190 | end 191 | task target_namespace => tasks 192 | end 193 | end 194 | end 195 | 196 | DataFusionPackageTask.new.define 197 | -------------------------------------------------------------------------------- /package/apt/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- sh-indentation: 2; sh-basic-offset: 2 -*- 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | 21 | LANG=C 22 | 23 | set -u 24 | 25 | run() 26 | { 27 | "$@" 28 | if test $? -ne 0; then 29 | echo "Failed $@" 30 | exit 1 31 | fi 32 | } 33 | 34 | . /host/env.sh 35 | 36 | distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') 37 | code_name=$(lsb_release --codename --short) 38 | case "${distribution}" in 39 | debian) 40 | component=main 41 | ;; 42 | ubuntu) 43 | component=universe 44 | ;; 45 | esac 46 | architecture=$(dpkg-architecture -q DEB_BUILD_ARCH) 47 | 48 | debuild_options=() 49 | dpkg_buildpackage_options=(-us -uc) 50 | 51 | run mkdir -p /build 52 | run cd /build 53 | find . -not -path ./ccache -a -not -path "./ccache/*" -delete 54 | if which ccache > /dev/null 2>&1; then 55 | export CCACHE_COMPILERCHECK=content 56 | export CCACHE_COMPRESS=1 57 | export CCACHE_COMPRESSLEVEL=6 58 | export CCACHE_DIR="${PWD}/ccache" 59 | export CCACHE_MAXSIZE=500M 60 | ccache --show-stats 61 | debuild_options+=(-eCCACHE_COMPILERCHECK) 62 | debuild_options+=(-eCCACHE_COMPRESS) 63 | debuild_options+=(-eCCACHE_COMPRESSLEVEL) 64 | debuild_options+=(-eCCACHE_DIR) 65 | debuild_options+=(-eCCACHE_MAXSIZE) 66 | if [ -d /usr/lib/ccache ] ;then 67 | debuild_options+=(--prepend-path=/usr/lib/ccache) 68 | fi 69 | fi 70 | run cp /host/tmp/${PACKAGE}-${VERSION}.tar.gz \ 71 | ${PACKAGE}_${VERSION}.orig.tar.gz 72 | run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz 73 | case "${VERSION}" in 74 | *~dev*) 75 | run mv ${PACKAGE}-$(echo $VERSION | sed -e 's/~dev/-dev/') \ 76 | ${PACKAGE}-${VERSION} 77 | ;; 78 | *~rc*) 79 | run mv ${PACKAGE}-$(echo $VERSION | sed -r -e 's/~rc[0-9]+//') \ 80 | ${PACKAGE}-${VERSION} 81 | ;; 82 | esac 83 | run cd ${PACKAGE}-${VERSION}/ 84 | platform="${distribution}-${code_name}" 85 | if [ -d "/host/tmp/debian.${platform}-${architecture}" ]; then 86 | run cp -rp "/host/tmp/debian.${platform}-${architecture}" debian 87 | elif [ -d "/host/tmp/debian.${platform}" ]; then 88 | run cp -rp "/host/tmp/debian.${platform}" debian 89 | else 90 | run cp -rp "/host/tmp/debian" debian 91 | fi 92 | : ${DEB_BUILD_OPTIONS:="parallel=$(nproc)"} 93 | # DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} noopt" 94 | export DEB_BUILD_OPTIONS 95 | if [ "${DEBUG:-no}" = "yes" ]; then 96 | run debuild "${debuild_options[@]}" "${dpkg_buildpackage_options[@]}" 97 | else 98 | run debuild "${debuild_options[@]}" "${dpkg_buildpackage_options[@]}" > /dev/null 99 | fi 100 | if which ccache > /dev/null 2>&1; then 101 | ccache --show-stats 102 | fi 103 | run cd - 104 | 105 | repositories="/host/repositories" 106 | package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/') 107 | pool_dir="${repositories}/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}" 108 | run mkdir -p "${pool_dir}/" 109 | run \ 110 | find . \ 111 | -maxdepth 1 \ 112 | -type f \ 113 | -not -path '*.build' \ 114 | -exec cp '{}' "${pool_dir}/" ';' 115 | 116 | run chown -R "$(stat --format "%u:%g" "${repositories}")" "${repositories}" 117 | -------------------------------------------------------------------------------- /package/apt/debian-bookworm-arm64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/debian:bookworm 16 | -------------------------------------------------------------------------------- /package/apt/debian-bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=debian:bookworm 16 | FROM ${FROM} 17 | 18 | RUN \ 19 | echo "debconf debconf/frontend select Noninteractive" | \ 20 | debconf-set-selections 21 | 22 | RUN \ 23 | echo 'APT::Install-Recommends "false";' > \ 24 | /etc/apt/apt.conf.d/disable-install-recommends 25 | 26 | RUN \ 27 | sed \ 28 | -i'' \ 29 | -e 's/main$/main contrib non-free/g' \ 30 | /etc/apt/sources.list.d/debian.sources 31 | 32 | ENV \ 33 | RUSTUP_HOME=/usr/local/rust \ 34 | CARGO_HOME=/usr/local/rust 35 | 36 | ARG DEBUG 37 | RUN \ 38 | quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \ 39 | apt update ${quiet} && \ 40 | apt install -y -V ${quiet} ca-certificates curl lsb-release && \ 41 | curl \ 42 | --fail \ 43 | --location \ 44 | --remote-name \ 45 | https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 46 | apt install -y -V ${quiet} ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 47 | rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 48 | apt update ${quiet} && \ 49 | apt install -y -V ${quiet} \ 50 | build-essential \ 51 | ccache \ 52 | cmake \ 53 | debhelper \ 54 | devscripts \ 55 | git \ 56 | gtk-doc-tools \ 57 | libarrow-glib-dev \ 58 | libarrow-glib-doc \ 59 | libgirepository1.0-dev \ 60 | libglib2.0-doc \ 61 | meson \ 62 | ninja-build \ 63 | pkg-config \ 64 | python3-pip \ 65 | ruby-dev \ 66 | tzdata \ 67 | valac && \ 68 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 69 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 70 | for exe in ${RUSTUP_HOME}/bin/*; do \ 71 | ( \ 72 | echo '#!/bin/sh'; \ 73 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 74 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 75 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 76 | ) > /usr/bin/${exe##*/} && \ 77 | chmod +x /usr/bin/${exe##*/}; \ 78 | done && \ 79 | MAKEFLAGS="-j$(nproc)" gem install red-parquet && \ 80 | apt clean 81 | -------------------------------------------------------------------------------- /package/apt/debian-bullseye-arm64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/debian:bullseye 16 | -------------------------------------------------------------------------------- /package/apt/debian-bullseye/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=debian:bullseye 16 | FROM ${FROM} 17 | 18 | RUN \ 19 | echo "debconf debconf/frontend select Noninteractive" | \ 20 | debconf-set-selections 21 | 22 | RUN \ 23 | echo 'APT::Install-Recommends "false";' > \ 24 | /etc/apt/apt.conf.d/disable-install-recommends 25 | 26 | RUN sed -i'' -e 's/main$/main contrib non-free/g' /etc/apt/sources.list 27 | 28 | ENV \ 29 | RUSTUP_HOME=/usr/local/rust \ 30 | CARGO_HOME=/usr/local/rust 31 | 32 | ARG DEBUG 33 | RUN \ 34 | quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \ 35 | apt update ${quiet} && \ 36 | apt install -y -V ${quiet} ca-certificates curl lsb-release && \ 37 | curl \ 38 | --fail \ 39 | --location \ 40 | --remote-name \ 41 | https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 42 | apt install -y -V ${quiet} ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 43 | rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 44 | apt update ${quiet} && \ 45 | apt install -y -V ${quiet} \ 46 | build-essential \ 47 | ccache \ 48 | cmake \ 49 | debhelper \ 50 | devscripts \ 51 | git \ 52 | gtk-doc-tools \ 53 | libarrow-glib-dev \ 54 | libarrow-glib-doc \ 55 | libgirepository1.0-dev \ 56 | libglib2.0-doc \ 57 | ninja-build \ 58 | pkg-config \ 59 | python3-pip \ 60 | ruby-dev \ 61 | tzdata \ 62 | valac && \ 63 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 64 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 65 | for exe in ${RUSTUP_HOME}/bin/*; do \ 66 | ( \ 67 | echo '#!/bin/sh'; \ 68 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 69 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 70 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 71 | ) > /usr/bin/${exe##*/} && \ 72 | chmod +x /usr/bin/${exe##*/}; \ 73 | done && \ 74 | pip3 install --upgrade meson && \ 75 | ln -s /usr/local/bin/meson /usr/bin/ && \ 76 | MAKEFLAGS="-j$(nproc)" gem install red-parquet && \ 77 | apt clean && \ 78 | rm -rf /var/lib/apt/lists/* 79 | -------------------------------------------------------------------------------- /package/apt/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -exu 18 | 19 | if [ $# -lt 1 ]; then 20 | echo "Usage: $0 rc" 21 | echo " $0 staging-rc" 22 | echo " $0 release" 23 | echo " $0 staging-release" 24 | echo " $0 local" 25 | echo " e.g.: $0 rc # Verify RC" 26 | echo " e.g.: $0 staging-rc # Verify RC on staging" 27 | echo " e.g.: $0 release # Verify release" 28 | echo " e.g.: $0 staging-release # Verify release on staging" 29 | echo " e.g.: $0 local # Verify packages on local" 30 | exit 1 31 | fi 32 | 33 | TYPE="$1" 34 | 35 | echo "::group::Prepare repository" 36 | 37 | export DEBIAN_FRONTEND=noninteractive 38 | 39 | APT_INSTALL="apt install -y -V --no-install-recommends" 40 | 41 | apt update 42 | ${APT_INSTALL} ca-certificates lsb-release wget 43 | 44 | code_name=$(lsb_release --codename --short) 45 | distribution=$(lsb_release --id --short | tr A-Z a-z) 46 | architecture=$(dpkg --print-architecture) 47 | 48 | artifactory_base_url="https://apache.jfrog.io/artifactory/arrow/${distribution}" 49 | case ${TYPE} in 50 | rc|staging-rc|staging-release) 51 | suffix=-${TYPE%-release} 52 | artifactory_base_url+="${suffix}" 53 | ;; 54 | esac 55 | 56 | wget ${artifactory_base_url}/apache-arrow-apt-source-latest-${code_name}.deb 57 | ${APT_INSTALL} ./apache-arrow-apt-source-latest-${code_name}.deb 58 | case ${TYPE} in 59 | rc|staging-rc|staging-release) 60 | sed -i'' \ 61 | -e "s,/${distribution}/,/${distribution}${suffix}/,g" \ 62 | /etc/apt/sources.list.d/apache-arrow.sources 63 | ;; 64 | esac 65 | apt update 66 | 67 | if [[ ${TYPE} == "local" ]]; then 68 | repositories_dir=/host/package/apt/repositories 69 | ${APT_INSTALL} \ 70 | ${repositories_dir}/${distribution}/pool/${code_name}/*/*/*/*_${architecture}.deb 71 | else 72 | ${APT_INSTALL} libdatafusion-glib-dev 73 | fi 74 | echo "::endgroup::" 75 | 76 | echo "::group::Test DataFusion C" 77 | ${APT_INSTALL} \ 78 | gcc \ 79 | libc6-dev \ 80 | make \ 81 | pkg-config 82 | mkdir -p build/c/ 83 | cp -a /host/example/sql.c build/c/ 84 | pushd build/c/ 85 | cc -o sql sql.c $(pkg-config --cflags --libs datafusion) 86 | ./sql 87 | popd 88 | echo "::endgroup::" 89 | 90 | echo "::group::Test DataFusion GLib" 91 | export G_DEBUG=fatal-warnings 92 | 93 | ${APT_INSTALL} valac 94 | mkdir -p build/vala/ 95 | cp -a /host/example/sql-glib.vala build/vala/ 96 | pushd build/vala/ 97 | valac --pkg datafusion-glib --pkg posix sql-glib.vala 98 | ./sql-glib 99 | popd 100 | 101 | ${APT_INSTALL} ruby-dev rubygems-integration 102 | gem install gobject-introspection 103 | ruby -r gi -e "p GI.load('DataFusion')" 104 | echo "::endgroup" 105 | -------------------------------------------------------------------------------- /package/apt/ubuntu-focal-arm64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/ubuntu:focal 16 | -------------------------------------------------------------------------------- /package/apt/ubuntu-focal/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=ubuntu:focal 16 | FROM ${FROM} 17 | 18 | RUN \ 19 | echo "debconf debconf/frontend select Noninteractive" | \ 20 | debconf-set-selections 21 | 22 | RUN \ 23 | echo 'APT::Install-Recommends "false";' > \ 24 | /etc/apt/apt.conf.d/disable-install-recommends 25 | 26 | ENV \ 27 | RUSTUP_HOME=/usr/local/rust \ 28 | CARGO_HOME=/usr/local/rust 29 | 30 | ARG DEBUG 31 | RUN \ 32 | quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \ 33 | apt update ${quiet} && \ 34 | apt install -y -V ${quiet} ca-certificates curl lsb-release && \ 35 | curl \ 36 | --fail \ 37 | --location \ 38 | --remote-name \ 39 | https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 40 | apt install -y -V ${quiet} ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 41 | rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 42 | apt update ${quiet} && \ 43 | apt install -y -V ${quiet} \ 44 | build-essential \ 45 | ccache \ 46 | cmake \ 47 | debhelper \ 48 | devscripts \ 49 | git \ 50 | gtk-doc-tools \ 51 | libarrow-glib-dev \ 52 | libarrow-glib-doc \ 53 | libgirepository1.0-dev \ 54 | libglib2.0-doc \ 55 | ninja-build \ 56 | pkg-config \ 57 | python3-pip \ 58 | ruby-dev \ 59 | tzdata \ 60 | valac && \ 61 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 62 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 63 | for exe in ${RUSTUP_HOME}/bin/*; do \ 64 | ( \ 65 | echo '#!/bin/sh'; \ 66 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 67 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 68 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 69 | ) > /usr/bin/${exe##*/} && \ 70 | chmod +x /usr/bin/${exe##*/}; \ 71 | done && \ 72 | pip3 install --upgrade meson && \ 73 | ln -s /usr/local/bin/meson /usr/bin/ && \ 74 | MAKEFLAGS="-j$(nproc)" gem install red-parquet && \ 75 | apt clean && \ 76 | rm -rf /var/lib/apt/lists/* 77 | -------------------------------------------------------------------------------- /package/apt/ubuntu-jammy-arm64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/ubuntu:jammy 16 | -------------------------------------------------------------------------------- /package/apt/ubuntu-jammy/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=ubuntu:jammy 16 | FROM ${FROM} 17 | 18 | RUN \ 19 | echo "debconf debconf/frontend select Noninteractive" | \ 20 | debconf-set-selections 21 | 22 | RUN \ 23 | echo 'APT::Install-Recommends "false";' > \ 24 | /etc/apt/apt.conf.d/disable-install-recommends 25 | 26 | ENV \ 27 | RUSTUP_HOME=/usr/local/rust \ 28 | CARGO_HOME=/usr/local/rust 29 | 30 | ARG DEBUG 31 | RUN \ 32 | quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \ 33 | apt update ${quiet} && \ 34 | apt install -y -V ${quiet} ca-certificates curl lsb-release && \ 35 | curl \ 36 | --fail \ 37 | --location \ 38 | --remote-name \ 39 | https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 40 | apt install -y -V ${quiet} ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 41 | rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \ 42 | apt update ${quiet} && \ 43 | apt install -y -V ${quiet} \ 44 | build-essential \ 45 | ccache \ 46 | cmake \ 47 | debhelper \ 48 | devscripts \ 49 | git \ 50 | gtk-doc-tools \ 51 | libarrow-glib-dev \ 52 | libarrow-glib-doc \ 53 | libgirepository1.0-dev \ 54 | libglib2.0-doc \ 55 | meson \ 56 | ninja-build \ 57 | pkg-config \ 58 | python3-pip \ 59 | ruby-dev \ 60 | tzdata \ 61 | valac && \ 62 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 63 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 64 | for exe in ${RUSTUP_HOME}/bin/*; do \ 65 | ( \ 66 | echo '#!/bin/sh'; \ 67 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 68 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 69 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 70 | ) > /usr/bin/${exe##*/} && \ 71 | chmod +x /usr/bin/${exe##*/}; \ 72 | done && \ 73 | MAKEFLAGS="-j$(nproc)" gem install red-parquet && \ 74 | apt clean && \ 75 | rm -rf /var/lib/apt/lists/* 76 | -------------------------------------------------------------------------------- /package/debian/changelog: -------------------------------------------------------------------------------- 1 | datafusion-c (21.0.0-1) unstable; urgency=low 2 | 3 | * New upstream release. 4 | 5 | -- Sutou Kouhei Mon, 03 Apr 2023 05:42:13 -0000 6 | 7 | datafusion-c (10.0.0-1) unstable; urgency=low 8 | 9 | * New upstream release. 10 | 11 | -- Sutou Kouhei Mon, 22 Aug 2022 08:45:33 -0000 12 | -------------------------------------------------------------------------------- /package/debian/compat: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /package/debian/control: -------------------------------------------------------------------------------- 1 | Source: datafusion-c 2 | Section: devel 3 | Priority: optional 4 | Maintainer: Sutou Kouhei 5 | Build-Depends: 6 | cmake, 7 | debhelper (>= 12), 8 | gtk-doc-tools, 9 | libarrow-glib-dev, 10 | libgirepository1.0-dev, 11 | ninja-build, 12 | pkg-config, 13 | valac, 14 | tzdata 15 | Build-Depends-Indep: 16 | libglib2.0-doc, 17 | libarrow-glib-doc 18 | Standards-Version: 4.1.4.1 19 | Homepage: https://github.com/datafusion-contrib/datafusion-c 20 | 21 | Package: libdatafusion21 22 | Section: libs 23 | Architecture: any 24 | Multi-Arch: same 25 | Pre-Depends: ${misc:Pre-Depends} 26 | Depends: 27 | ${misc:Depends}, 28 | ${shlibs:Depends} 29 | Description: DataFusion C is C API for DataFusion 30 | . 31 | This package provides C library files. 32 | 33 | Package: libdatafusion-dev 34 | Section: libdevel 35 | Architecture: any 36 | Multi-Arch: same 37 | Depends: 38 | ${misc:Depends}, 39 | libdatafusion21 (= ${binary:Version}) 40 | Description: DataFusion C is C API for DataFusion 41 | . 42 | This package provides C header files. 43 | 44 | Package: libdatafusion-glib21 45 | Section: libs 46 | Architecture: any 47 | Multi-Arch: same 48 | Pre-Depends: ${misc:Pre-Depends} 49 | Depends: 50 | ${misc:Depends}, 51 | ${shlibs:Depends}, 52 | libdatafusion21 (= ${binary:Version}) 53 | Description: DataFusion GLib is GLib API for DataFusion 54 | . 55 | This package provides GLib based library files. 56 | 57 | Package: gir1.2-datafusion-21.0 58 | Section: introspection 59 | Architecture: any 60 | Multi-Arch: same 61 | Depends: 62 | ${gir:Depends}, 63 | ${misc:Depends} 64 | Description: DataFusion GLib is GLib API for DataFusion 65 | . 66 | This package provides GObject Introspection typelib files. 67 | 68 | Package: libdatafusion-glib-dev 69 | Section: libdevel 70 | Architecture: any 71 | Multi-Arch: same 72 | Depends: 73 | ${misc:Depends}, 74 | gir1.2-datafusion-21.0 (= ${binary:Version}), 75 | libarrow-glib-dev, 76 | libdatafusion-dev (= ${binary:Version}), 77 | libdatafusion-glib21 (= ${binary:Version}) 78 | Suggests: libdatafusion-glib-doc 79 | Description: DataFusion GLib is GLib API for DataFusion 80 | . 81 | This package provides GLib based header files. 82 | 83 | Package: libdatafusion-glib-doc 84 | Section: doc 85 | Architecture: all 86 | Multi-Arch: foreign 87 | Depends: 88 | ${misc:Depends} 89 | Recommends: libarrow-glibglib-doc 90 | Description: DataFusion GLib is GLib API for DataFusion 91 | . 92 | This package provides documentations. 93 | -------------------------------------------------------------------------------- /package/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: DataFusion C 3 | Upstream-Contact: https://github.com/datafusion-contrib/datafusion-c 4 | Source: https://github.com/datafusion-contrib/datafusion-c 5 | 6 | Files: * 7 | Copyright: 2022 Sutou Kouhei 8 | License: Apache-2.0 9 | 10 | License: Apache-2.0 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | . 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | . 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | . 23 | On Debian systems, the full text of the Apache Software License version 2 can 24 | be found in the file `/usr/share/common-licenses/Apache-2.0'. 25 | -------------------------------------------------------------------------------- /package/debian/gir1.2-datafusion-21.0.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/girepository-1.0/DataFusion-*.typelib 2 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/datafusion.h 2 | usr/lib/*/cmake/datafusion/ 3 | usr/lib/*/libdatafusion.so 4 | usr/lib/*/pkgconfig/datafusion.pc 5 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-glib-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/datafusion-glib/ 2 | usr/lib/*/cmake/datafusion-glib/ 3 | usr/lib/*/libdatafusion-glib.a 4 | usr/lib/*/libdatafusion-glib.so 5 | usr/lib/*/pkgconfig/datafusion-glib.pc 6 | usr/share/datafusion-glib/example/ 7 | usr/share/gir-1.0/DataFusion-*.gir 8 | usr/share/vala/vapi/datafusion-glib.* 9 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-glib-doc.doc-base: -------------------------------------------------------------------------------- 1 | Document: datafusion-glib 2 | Title: DataFusion GLib Reference Manual 3 | Author: Sutou Kouhei 4 | Abstract: DataFusion GLib is GLib API for DataFusion. 5 | Section: Programming 6 | 7 | Format: HTML 8 | Index: /usr/share/gtk-doc/html/datafusion-glib/index.html 9 | Files: /usr/share/gtk-doc/html/datafusion-glib/*.html 10 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-glib-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/gtk-doc/html/datafusion-glib 2 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-glib-doc.links: -------------------------------------------------------------------------------- 1 | usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libdatafusion-glib-doc/arrow-glib 2 | usr/share/doc/libglib2.0-doc/glib usr/share/doc/libdatafusion-glib-doc/glib 3 | usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libdatafusion-glib-doc/gobject 4 | usr/share/gtk-doc/html/datafusion-glib usr/share/doc/libdatafusion-glib-doc/datafusion-glib 5 | -------------------------------------------------------------------------------- /package/debian/libdatafusion-glib21.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libdatafusion-glib.so.* 2 | -------------------------------------------------------------------------------- /package/debian/libdatafusion21.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libdatafusion.so.* 2 | -------------------------------------------------------------------------------- /package/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile-gmake -*- 3 | # 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | # This has to be exported to make some magic below work. 7 | export DH_OPTIONS 8 | 9 | export DEB_BUILD_MAINT_OPTIONS=reproducible=-timeless 10 | 11 | %: 12 | dh $@ --with gir --buildsystem=meson+ninja 13 | 14 | override_dh_auto_configure: 15 | dh_auto_configure \ 16 | -- \ 17 | --buildtype=debugoptimized \ 18 | --default-library=both \ 19 | -Ddoc=true \ 20 | -Dvapi=true 21 | -------------------------------------------------------------------------------- /package/yum/almalinux-8-aarch64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/almalinux:8 16 | -------------------------------------------------------------------------------- /package/yum/almalinux-8/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=almalinux:8 16 | FROM ${FROM} 17 | 18 | ENV \ 19 | RUSTUP_HOME=/usr/local/rust \ 20 | CARGO_HOME=/usr/local/rust 21 | 22 | ARG DEBUG 23 | RUN \ 24 | quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \ 25 | dnf install -y ${quiet} epel-release && \ 26 | dnf install -y ${quiet} https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm && \ 27 | dnf install --enablerepo=powertools -y ${quiet} \ 28 | arrow-glib-devel \ 29 | arrow-glib-doc \ 30 | ccache \ 31 | cmake \ 32 | gcc \ 33 | gcc-c++ \ 34 | git \ 35 | gobject-introspection-devel \ 36 | gtk-doc \ 37 | ninja-build \ 38 | make \ 39 | pkg-config \ 40 | python39-pip \ 41 | rpmdevtools \ 42 | ruby-devel \ 43 | tzdata \ 44 | vala && \ 45 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 46 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 47 | for exe in ${RUSTUP_HOME}/bin/*; do \ 48 | ( \ 49 | echo '#!/bin/sh'; \ 50 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 51 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 52 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 53 | ) > /usr/bin/${exe##*/} && \ 54 | chmod +x /usr/bin/${exe##*/}; \ 55 | done && \ 56 | MAKEFLAGS="-j$(nproc)" gem install red-arrow && \ 57 | dnf clean ${quiet} all 58 | -------------------------------------------------------------------------------- /package/yum/almalinux-9-aarch64/from: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | arm64v8/almalinux:9 16 | -------------------------------------------------------------------------------- /package/yum/almalinux-9/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG FROM=almalinux:9 16 | FROM ${FROM} 17 | 18 | ENV \ 19 | RUSTUP_HOME=/usr/local/rust \ 20 | CARGO_HOME=/usr/local/rust 21 | 22 | ARG DEBUG 23 | RUN \ 24 | quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \ 25 | dnf install -y ${quiet} epel-release && \ 26 | dnf install -y ${quiet} https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm && \ 27 | dnf install --enablerepo=crb -y ${quiet} \ 28 | arrow-glib-devel \ 29 | arrow-glib-doc \ 30 | ccache \ 31 | cmake \ 32 | gcc \ 33 | gcc-c++ \ 34 | git \ 35 | gobject-introspection-devel \ 36 | gtk-doc \ 37 | ninja-build \ 38 | make \ 39 | pkg-config \ 40 | python3-pip \ 41 | rpmdevtools \ 42 | ruby-devel \ 43 | tzdata \ 44 | vala && \ 45 | curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \ 46 | ${RUSTUP_HOME}/bin/cargo install cargo-c && \ 47 | for exe in ${RUSTUP_HOME}/bin/*; do \ 48 | ( \ 49 | echo '#!/bin/sh'; \ 50 | echo "export RUSTUP_HOME=${RUSTUP_HOME}"; \ 51 | echo "export CARGO_HOME=${CARGO_HOME}"; \ 52 | echo 'exec ${RUSTUP_HOME}/bin/${0##*/} "$@"'; \ 53 | ) > /usr/bin/${exe##*/} && \ 54 | chmod +x /usr/bin/${exe##*/}; \ 55 | done && \ 56 | MAKEFLAGS="-j$(nproc)" gem install red-arrow && \ 57 | dnf clean ${quiet} all 58 | -------------------------------------------------------------------------------- /package/yum/datafusion-c.spec.in: -------------------------------------------------------------------------------- 1 | # -*- sh-shell: rpm -*- 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # TODO: Enable debug package 18 | %define debug_package %{nil} 19 | 20 | %define major_version %(echo @VERSION@ | grep -o '^[0-9]*') 21 | 22 | Name: @PACKAGE@ 23 | Version: @VERSION@ 24 | Release: @RELEASE@%{?dist} 25 | Summary: DataFusion C is C API for DataFusion 26 | 27 | License: Apache-2.0 28 | URL: https://github.com/datafusion-contrib/datafusion-c 29 | Source0: https://github.com/datafusion-contrib/datafusion-c/releases/download/%{version}/%{name}-%{version}.tar.gz 30 | 31 | BuildRequires: gcc 32 | BuildRequires: git 33 | BuildRequires: gobject-introspection-devel 34 | BuildRequires: gtk-doc 35 | BuildRequires: ninja-build 36 | BuildRequires: pkgconfig 37 | BuildRequires: vala 38 | 39 | %description 40 | DataFusion C is C API for DataFusion. 41 | 42 | %prep 43 | %setup -q 44 | 45 | %build 46 | pip3 install meson 47 | meson setup build \ 48 | --buildtype=debugoptimized \ 49 | --default-library=both \ 50 | --libdir=%{_libdir} \ 51 | --prefix=%{_prefix} \ 52 | -Ddoc=true \ 53 | -Dvapi=true 54 | meson compile -C build %{?_smp_mflags} 55 | 56 | %install 57 | DESTDIR=%{buildroot} meson install -C build 58 | 59 | %package -n datafusion%{major_version}-libs 60 | Summary: Runtime libraries for DataFusion C 61 | License: Apache-2.0 62 | 63 | %description -n datafusion%{major_version}-libs 64 | This package contains the libraries for DataFusion C. 65 | 66 | %files -n datafusion%{major_version}-libs 67 | %defattr(-,root,root,-) 68 | %doc README.md 69 | %license LICENSE 70 | %{_libdir}/libdatafusion.so.* 71 | 72 | %package -n datafusion-devel 73 | Summary: Libraries and header files for DataFusion C 74 | License: Apache-2.0 75 | Requires: datafusion%{major_version}-libs = %{version}-%{release} 76 | 77 | %description -n datafusion-devel 78 | Libraries and header files for DataFusion C. 79 | 80 | %files -n datafusion-devel 81 | %defattr(-,root,root,-) 82 | %doc README.md 83 | %license LICENSE 84 | %{_includedir}/datafusion.h 85 | %{_libdir}/cmake/datafusion/ 86 | %{_libdir}/libdatafusion.so 87 | %{_libdir}/pkgconfig/datafusion.pc 88 | 89 | %package -n datafusion-examples 90 | Summary: Examples for DataFusion C 91 | License: Apache-2.0 92 | Requires: datafusion-devel = %{version}-%{release} 93 | 94 | %description -n datafusion-examples 95 | Examples for DataFusion C. 96 | 97 | %files -n datafusion-examples 98 | %defattr(-,root,root,-) 99 | %doc README.md 100 | %license LICENSE 101 | %{_datadir}/datafusion/example/ 102 | 103 | %package -n datafusion-glib%{major_version}-libs 104 | Summary: Runtime libraries for DataFusion GLib 105 | License: Apache-2.0 106 | Requires: datafusion%{major_version}-libs = %{version}-%{release} 107 | Requires: glib2 108 | 109 | %description -n datafusion-glib%{major_version}-libs 110 | This package contains the libraries for Data Fusion GLib. 111 | 112 | %files -n datafusion-glib%{major_version}-libs 113 | %defattr(-,root,root,-) 114 | %doc README.md 115 | %license LICENSE 116 | %{_libdir}/girepository-1.0/DataFusion-*.typelib 117 | %{_libdir}/libdatafusion-glib.so.* 118 | 119 | %package -n datafusion-glib-devel 120 | Summary: Libraries and header files for DataFusion GLib 121 | License: Apache-2.0 122 | Requires: arrow-glib-devel 123 | Requires: datafusion-devel = %{version}-%{release} 124 | Requires: datafusion-glib%{major_version}-libs = %{version}-%{release} 125 | Requires: glib2-devel 126 | Requires: gobject-introspection-devel 127 | 128 | %description -n datafusion-glib-devel 129 | Libraries and header files for DataFusion GLib. 130 | 131 | %files -n datafusion-glib-devel 132 | %defattr(-,root,root,-) 133 | %doc README.md 134 | %license LICENSE 135 | %{_includedir}/datafusion-glib/ 136 | %{_libdir}/cmake/datafusion-glib/ 137 | %{_libdir}/libdatafusion-glib.a 138 | %{_libdir}/libdatafusion-glib.so 139 | %{_libdir}/pkgconfig/datafusion-glib.pc 140 | %{_datadir}/gir-1.0/DataFusion-*.gir 141 | %{_datadir}/vala/vapi/datafusion-glib.* 142 | 143 | %package -n datafusion-glib-doc 144 | Summary: Documentation for DataFusion GLib 145 | License: Apache-2.0 146 | 147 | %description -n datafusion-glib-doc 148 | Documentation for DataFusion GLib. 149 | 150 | %files -n datafusion-glib-doc 151 | %defattr(-,root,root,-) 152 | %doc README.md 153 | %license LICENSE 154 | %{_datadir}/gtk-doc/html/datafusion-glib/ 155 | 156 | %package -n datafusion-glib-examples 157 | Summary: Examples for DataFusion GLib 158 | License: Apache-2.0 159 | Requires: datafusion-glib-devel = %{version}-%{release} 160 | 161 | %description -n datafusion-glib-examples 162 | Examples for DataFusion GLib. 163 | 164 | %files -n datafusion-glib-examples 165 | %defattr(-,root,root,-) 166 | %doc README.md 167 | %license LICENSE 168 | %{_datadir}/datafusion-glib/example/ 169 | 170 | %changelog 171 | * Mon Apr 03 2023 Sutou Kouhei - 21.0.0-1 172 | - New upstream release. 173 | 174 | * Mon Aug 22 2022 Sutou Kouhei - 10.0.0-1 175 | - New upstream release. 176 | -------------------------------------------------------------------------------- /package/yum/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -exu 18 | 19 | if [ $# -lt 1 ]; then 20 | echo "Usage: $0 rc" 21 | echo " $0 staging-rc" 22 | echo " $0 release" 23 | echo " $0 staging-release" 24 | echo " $0 local" 25 | echo " e.g.: $0 rc # Verify RC" 26 | echo " e.g.: $0 staging-rc # Verify RC on staging" 27 | echo " e.g.: $0 release # Verify release" 28 | echo " e.g.: $0 staging-release # Verify release on staging" 29 | echo " e.g.: $0 local # Verify packages on local" 30 | exit 1 31 | fi 32 | 33 | TYPE="$1" 34 | 35 | echo "::group::Prepare repository" 36 | 37 | distribution=$(. /etc/os-release && echo "${ID}") 38 | distribution_version=$(. /etc/os-release && echo "${VERSION_ID}" | grep -o "^[0-9]*") 39 | 40 | artifactory_base_url="https://apache.jfrog.io/artifactory/arrow/${distribution}" 41 | case ${TYPE} in 42 | rc|staging-rc|staging-release) 43 | suffix=-${TYPE%-release} 44 | artifactory_base_url+="${suffix}" 45 | ;; 46 | esac 47 | dnf install -y ${artifactory_base_url}/${distribution_version}/apache-arrow-release-latest.rpm 48 | case ${TYPE} in 49 | rc|staging-rc|staging-release) 50 | sed -i'' \ 51 | -e "s,/${distribution}/,/${distribution}${suffix}/,g" \ 52 | /etc/yum.repos.d/Apache-Arrow.repo 53 | ;; 54 | esac 55 | 56 | case ${distribution_version} in 57 | 8) 58 | DNF_INSTALL="dnf install -y --enablerepo=powertools" 59 | ;; 60 | *) 61 | DNF_INSTALL="dnf install -y --enablerepo=crb" 62 | ;; 63 | esac 64 | 65 | # TODO: This is a workaround to install datafusion-glib-devel. 66 | # We can remove this when Apache Arrow 10.0.0 is released. 67 | ${DNF_INSTALL} \ 68 | arrow-glib-devel 69 | 70 | if [[ ${TYPE} == "local" ]]; then 71 | repositories_dir=/host/package/yum/repositories/ 72 | ${DNF_INSTALL} \ 73 | ${repositories_dir}/${distribution}/${distribution_version}/$(arch)/Packages/*.rpm 74 | else 75 | ${DNF_INSTALL} datafusion-glib-devel 76 | fi 77 | echo "::endgroup::" 78 | 79 | echo "::group::Test DataFusion C" 80 | ${DNF_INSTALL} \ 81 | gcc \ 82 | make \ 83 | pkg-config 84 | mkdir -p build/c/ 85 | cp -a /host/example/sql.c build/c/ 86 | pushd build/c/ 87 | cc -o sql sql.c $(pkg-config --cflags --libs datafusion) 88 | ./sql 89 | popd 90 | echo "::endgroup::" 91 | 92 | echo "::group::Test DataFusion GLib" 93 | export G_DEBUG=fatal-warnings 94 | 95 | ${DNF_INSTALL} vala 96 | mkdir -p build/vala/ 97 | cp -a /host/example/sql-glib.vala build/vala/ 98 | pushd build/vala/ 99 | valac --pkg datafusion-glib --pkg posix sql-glib.vala 100 | ./sql-glib 101 | popd 102 | 103 | ${DNF_INSTALL} ruby-devel redhat-rpm-config 104 | MAKEFLAGS="-j$(nproc)" gem install gobject-introspection 105 | ruby -r gi -e "p GI.load('DataFusion')" 106 | echo "::endgroup" 107 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | 14 | Jinja2 15 | Pygments 16 | Sphinx 17 | breathe 18 | gi-docgen 19 | meson 20 | myst_parser 21 | pydata_sphinx_theme 22 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | edition = "2021" 16 | max_width = 90 17 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Sutou Kouhei 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "capi")] 16 | mod capi; 17 | -------------------------------------------------------------------------------- /test/helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require "tempfile" 16 | require "tmpdir" 17 | 18 | require "test-unit" 19 | 20 | require "arrow" 21 | require "parquet" 22 | require "gi" 23 | 24 | DataFusion = GI.load("DataFusion") 25 | -------------------------------------------------------------------------------- /test/run.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | $VERBOSE = true 18 | 19 | require "pathname" 20 | 21 | (ENV["DATAFUSION_DLL_PATH"] || "").split(File::PATH_SEPARATOR).each do |path| 22 | RubyInstaller::Runtime.add_dll_directory(path) 23 | end 24 | 25 | source_dir = Pathname.new(__dir__).parent.expand_path 26 | lib_dir = source_dir + "lib" 27 | test_dir = source_dir + "test" 28 | 29 | $LOAD_PATH.unshift(lib_dir.to_s) 30 | 31 | require_relative "helper" 32 | 33 | exit(Test::Unit::AutoRunner.run(true, test_dir.to_s)) 34 | -------------------------------------------------------------------------------- /test/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2022 Sutou Kouhei 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | test_dir="$(cd $(dirname $0); pwd)" 18 | build_dir="$(cd .; pwd)" 19 | 20 | if [ "${BUILD}" != "no" -a -f "build.ninja" ]; then 21 | ninja || exit $? 22 | fi 23 | 24 | case "$(uname -s)" in 25 | Linux) 26 | export LD_LIBRARY_PATH="${build_dir}/datafusion-glib:${build_dir}:${LD_LIBRARY_PATH}" 27 | ;; 28 | Darwin) 29 | export DYLD_LIBRARY_PATH="${build_dir}/datafusion-glib:${build_dir}:${DYLD_LIBRARY_PATH}" 30 | ;; 31 | esac 32 | 33 | export GI_TYPELIB_PATH="${build_dir}/datafusion-glib:${GI_TYPELIB_PATH}" 34 | 35 | ${GDB} ruby ${test_dir}/run.rb "$@" 36 | -------------------------------------------------------------------------------- /test/test-csv-read-options.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class CSVReadOptionsTest < Test::Unit::TestCase 16 | def setup 17 | @options = DataFusion::CSVReadOptions.new 18 | end 19 | 20 | def test_has_header 21 | assert do 22 | @options.has_header? 23 | end 24 | @options.has_header = false 25 | assert do 26 | not @options.has_header? 27 | end 28 | end 29 | 30 | def test_delimiter 31 | assert_equal(",".ord, @options.delimiter) 32 | @options.delimiter = "\t".ord 33 | assert_equal("\t".ord, @options.delimiter) 34 | end 35 | 36 | def test_schema 37 | assert_nil(@options.schema) 38 | schema = Arrow::Schema.new("a" => :int64) 39 | @options.schema = schema 40 | assert_equal(schema, @options.schema) 41 | end 42 | 43 | def test_schema_infer_max_n_records 44 | assert_equal(1000, @options.schema_infer_max_n_records) 45 | @options.schema_infer_max_n_records = 100 46 | assert_equal(100, @options.schema_infer_max_n_records) 47 | end 48 | 49 | def test_file_extension 50 | assert_equal(".csv", @options.file_extension) 51 | @options.file_extension = ".tsv" 52 | assert_equal(".tsv", @options.file_extension) 53 | end 54 | 55 | def test_table_partition_columns 56 | assert_nil(@options.table_partition_columns) 57 | table_partition_columns = Arrow::Schema.new(a: :int8, 58 | b: :boolean) 59 | @options.table_partition_columns = table_partition_columns 60 | assert_equal(table_partition_columns, 61 | @options.table_partition_columns) 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /test/test-data-frame.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class DataFrameTest < Test::Unit::TestCase 16 | def setup 17 | context = DataFusion::SessionContext.new 18 | table = Arrow::Table.new(number: [1, 2, 3]) 19 | context.register_table("data", table) 20 | @data_frame = context.sql("SELECT * FROM data") 21 | Dir.mktmpdir do |tmp_dir| 22 | @tmp_dir = tmp_dir 23 | yield 24 | end 25 | end 26 | 27 | def test_to_table 28 | assert_equal(Arrow::Table.new(number: Arrow::UInt8Array.new([1, 2, 3])), 29 | @data_frame.to_table) 30 | end 31 | 32 | sub_test_case("#write_parquet") do 33 | def test_no_properties 34 | path = File.join(@tmp_dir, "parquet") 35 | @data_frame.write_parquet(path) 36 | assert_equal(@data_frame.to_table, 37 | Arrow::Table.load(File.join(path, "part-0.parquet"))) 38 | end 39 | 40 | def test_max_row_group_size 41 | path = File.join(@tmp_dir, "parquet") 42 | properties = DataFusion::ParquetWriterProperties.new 43 | properties.max_row_group_size = 1 44 | @data_frame.write_parquet(path, properties) 45 | parquet_path = File.join(path, "part-0.parquet") 46 | Arrow::MemoryMappedInputStream.open(parquet_path) do |input| 47 | reader = Parquet::ArrowFileReader.new(input) 48 | assert_equal(3, reader.n_row_groups) 49 | end 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /test/test-error.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class ErrorTest < Test::Unit::TestCase 16 | def setup 17 | context = DataFusion::SessionContext.new 18 | begin 19 | context.sql("SELECT nonexistent") 20 | rescue => error 21 | @error = error 22 | end 23 | end 24 | 25 | def test_code 26 | assert_equal(DataFusion::Error::SCHEMA, @error.code) 27 | end 28 | 29 | def test_message 30 | assert_equal("[session-context][sql] Schema error: " + 31 | "No field named \"nonexistent\".", 32 | @error.message) 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /test/test-parquet-read-options.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class ParquetReadOptionsTest < Test::Unit::TestCase 16 | def setup 17 | @options = DataFusion::ParquetReadOptions.new 18 | end 19 | 20 | def test_file_extension 21 | assert_equal(".parquet", @options.file_extension) 22 | @options.file_extension = ".pqt" 23 | assert_equal(".pqt", @options.file_extension) 24 | end 25 | 26 | def test_table_partition_columns 27 | assert_nil(@options.table_partition_columns) 28 | table_partition_columns = Arrow::Schema.new(a: :int8, 29 | b: :boolean) 30 | @options.table_partition_columns = table_partition_columns 31 | assert_equal(table_partition_columns, 32 | @options.table_partition_columns) 33 | end 34 | 35 | def test_pruning 36 | assert do 37 | not @options.set_pruning? 38 | end 39 | @options.pruning = false 40 | assert do 41 | @options.set_pruning? 42 | end 43 | assert do 44 | not @options.pruning? 45 | end 46 | @options.unset_pruning 47 | assert do 48 | not @options.set_pruning? 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /test/test-session-context.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2022-2023 Sutou Kouhei 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class SessionContextTest < Test::Unit::TestCase 16 | def setup 17 | @context = DataFusion::SessionContext.new 18 | end 19 | 20 | def test_sql 21 | schema = Arrow::Schema.new([Arrow::Field.new("Int64(1)", :int64, false)]) 22 | assert_equal(Arrow::Table.new(schema, [Arrow::Int64Array.new([1])]), 23 | @context.sql("SELECT 1").to_table) 24 | end 25 | 26 | def test_deregister 27 | record_batch = Arrow::RecordBatch.new(boolean: [true, false, nil], 28 | integer: [1, nil, 3]) 29 | assert do 30 | @context.register_record_batch("data", record_batch) 31 | end 32 | data_frame = @context.sql("SELECT * FROM data") 33 | assert_equal(record_batch.to_table, data_frame.to_table) 34 | assert do 35 | @context.deregister("data") 36 | end 37 | message = "[session-context][sql] Error during planning: " + 38 | "table 'datafusion.public.data' not found" 39 | assert_raise(DataFusion::Error::Plan.new(message)) do 40 | @context.sql("SELECT * FROM data") 41 | end 42 | end 43 | 44 | def test_register_record_batch 45 | record_batch = Arrow::RecordBatch.new(boolean: [true, false, nil], 46 | integer: [1, nil, 3]) 47 | assert do 48 | @context.register_record_batch("data", record_batch) 49 | end 50 | data_frame = @context.sql("SELECT * FROM data") 51 | assert_equal(record_batch.to_table, data_frame.to_table) 52 | end 53 | 54 | def test_register_table 55 | boolean_chunks = [ 56 | Arrow::Array.new([true]), 57 | Arrow::Array.new([false, nil]), 58 | ] 59 | integer_chunks = [ 60 | Arrow::Array.new([1, nil]), 61 | Arrow::Array.new([3]), 62 | ] 63 | table = Arrow::Table.new(boolean: Arrow::ChunkedArray.new(boolean_chunks), 64 | integer: Arrow::ChunkedArray.new(integer_chunks)) 65 | @context.register_table("data", table) 66 | data_frame = @context.sql("SELECT * FROM data") 67 | assert_equal(table, data_frame.to_table) 68 | end 69 | 70 | sub_test_case("#register_csv") do 71 | def setup 72 | super 73 | Tempfile.open(["datafusion", ".csv"]) do |csv_file| 74 | @csv_file = csv_file 75 | @csv_file.puts(<<-CSV) 76 | a,b,c 77 | 1,2,3 78 | 10,20,30 79 | CSV 80 | @csv_file.close 81 | schema = Arrow::Schema.new([ 82 | Arrow::Field.new("a", :int64), 83 | Arrow::Field.new("b", :int64), 84 | Arrow::Field.new("c", :int64), 85 | ]) 86 | @table = Arrow::Table.new(schema, 87 | [ 88 | Arrow::Int64Array.new([1, 10]), 89 | Arrow::Int64Array.new([2, 20]), 90 | Arrow::Int64Array.new([3, 30]), 91 | ]) 92 | yield 93 | end 94 | end 95 | 96 | def test_no_options 97 | assert do 98 | @context.register_csv("data", @csv_file.path) 99 | end 100 | data_frame = @context.sql("SELECT * FROM data") 101 | assert_equal(@table, data_frame.to_table) 102 | end 103 | 104 | def test_options 105 | options = DataFusion::CSVReadOptions.new 106 | schema = Arrow::Schema.new([ 107 | Arrow::Field.new("a", :int8, false), 108 | Arrow::Field.new("b", :int8, false), 109 | Arrow::Field.new("c", :int8, false), 110 | ]) 111 | table = Arrow::Table.new(schema, 112 | [ 113 | Arrow::Int8Array.new([1, 10]), 114 | Arrow::Int8Array.new([2, 20]), 115 | Arrow::Int8Array.new([3, 30]), 116 | ]) 117 | options.schema = schema 118 | assert do 119 | @context.register_csv("data", @csv_file.path, options) 120 | end 121 | data_frame = @context.sql("SELECT * FROM data") 122 | assert_equal(table, data_frame.to_table) 123 | end 124 | end 125 | end 126 | --------------------------------------------------------------------------------