From 108523befb63b2ea0a7b94bda4caf3745ff363d9 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 4 Oct 2024 13:23:05 -0700 Subject: [PATCH 01/63] Add back tdd definitions. --- vector/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vector/pom.xml b/vector/pom.xml index aba35a606a..e0a71b5bd7 100644 --- a/vector/pom.xml +++ b/vector/pom.xml @@ -89,6 +89,14 @@ under the License. + + + codegen + + ${basedir}/src/main/codegen + + org.apache.maven.plugins From 05cbcd6a372fac2ed330c33c6b26b31edc3458be Mon Sep 17 00:00:00 2001 From: DenisTarasyuk Date: Tue, 16 Apr 2024 19:09:52 +0300 Subject: [PATCH 02/63] DX-88565 Fixed gandiva native library loading option to be global Added jna library which allows more control over native code loading --- .../org/apache/arrow/gandiva/evaluator/JniLoader.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java index 6f4cdc58c5..65fcd086a9 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.util.Collections; import java.util.Locale; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -31,6 +32,9 @@ /** This class handles loading of the jni library, and acts as a bridge for the native functions. */ class JniLoader { private static final String LIBRARY_NAME = "gandiva_jni"; + + private static final int RTLD_GLOBAL = 0x00100; + private static final int RTLD_LAZY = 0x00001; private static volatile JniLoader INSTANCE; private static volatile long defaultConfiguration = 0L; @@ -69,6 +73,10 @@ private static void loadGandivaLibraryFromJar(final String tmpDir) final String libraryToLoad = LIBRARY_NAME + "/" + getNormalizedArch() + "/" + System.mapLibraryName(LIBRARY_NAME); final File libraryFile = moveFileFromJarToTemp(tmpDir, libraryToLoad, LIBRARY_NAME); + NativeLibrary.getInstance( + libraryFile.getAbsolutePath(), + Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL)) + ); System.load(libraryFile.getAbsolutePath()); } From 5870db170df25d714136587abca9684bbc627d54 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 25 Sep 2024 14:35:41 -0700 Subject: [PATCH 03/63] Various include fixes --- gandiva/pom.xml | 5 +++++ .../apache/arrow/gandiva/evaluator/FunctionSignature.java | 2 ++ .../java/org/apache/arrow/gandiva/evaluator/JniLoader.java | 3 +++ .../org/apache/arrow/gandiva/expression/FunctionNode.java | 2 ++ 4 files changed, 12 insertions(+) diff --git a/gandiva/pom.xml b/gandiva/pom.xml index 190bf016ce..a4c65dfde5 100644 --- a/gandiva/pom.xml +++ b/gandiva/pom.xml @@ -67,6 +67,11 @@ under the License. org.slf4j slf4j-api + + net.java.dev.jna + jna + 5.14.0 + diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java index 164b6aaac6..66a795723e 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java @@ -18,6 +18,8 @@ import com.google.common.base.MoreObjects; import com.google.common.base.Objects; + +import java.util.ArrayList; import java.util.List; import org.apache.arrow.vector.types.pojo.ArrowType; diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java index 65fcd086a9..3cb8ef6b95 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java @@ -29,6 +29,9 @@ import java.util.concurrent.ConcurrentMap; import org.apache.arrow.gandiva.exceptions.GandivaException; +import com.sun.jna.Library; +import com.sun.jna.NativeLibrary; + /** This class handles loading of the jni library, and acts as a bridge for the native functions. */ class JniLoader { private static final String LIBRARY_NAME = "gandiva_jni"; diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java index a5c6fb77f9..d88dcb5647 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java @@ -17,6 +17,8 @@ package org.apache.arrow.gandiva.expression; import java.util.List; + +import org.apache.arrow.flatbuf.Type; import org.apache.arrow.gandiva.exceptions.GandivaException; import org.apache.arrow.gandiva.ipc.GandivaTypes; import org.apache.arrow.vector.types.pojo.ArrowType; From d032675dac96d73a4af6968a724e86016f0c06f1 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 13 Dec 2024 09:31:31 -0800 Subject: [PATCH 04/63] Fix package error for jna include. --- gandiva/src/main/java/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/gandiva/src/main/java/module-info.java b/gandiva/src/main/java/module-info.java index 49deed1857..9724a97df1 100644 --- a/gandiva/src/main/java/module-info.java +++ b/gandiva/src/main/java/module-info.java @@ -26,4 +26,5 @@ requires org.apache.arrow.memory.core; requires org.apache.arrow.vector; requires org.slf4j; + requires com.sun.jna; } From da055c8541e686e04cef7c8144e8c90adabf43c9 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 14 Feb 2025 11:28:41 -0800 Subject: [PATCH 05/63] Dremio updates --- .../org/apache/arrow/gandiva/evaluator/JniLoader.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java index 3cb8ef6b95..ae7deaa036 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java @@ -18,6 +18,8 @@ import static java.util.UUID.randomUUID; +import com.sun.jna.Library; +import com.sun.jna.NativeLibrary; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -35,9 +37,9 @@ /** This class handles loading of the jni library, and acts as a bridge for the native functions. */ class JniLoader { private static final String LIBRARY_NAME = "gandiva_jni"; - + private static final int RTLD_GLOBAL = 0x00100; - private static final int RTLD_LAZY = 0x00001; + private static final int RTLD_LAZY = 0x00001; private static volatile JniLoader INSTANCE; private static volatile long defaultConfiguration = 0L; @@ -78,8 +80,7 @@ private static void loadGandivaLibraryFromJar(final String tmpDir) final File libraryFile = moveFileFromJarToTemp(tmpDir, libraryToLoad, LIBRARY_NAME); NativeLibrary.getInstance( libraryFile.getAbsolutePath(), - Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL)) - ); + Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL))); System.load(libraryFile.getAbsolutePath()); } From e74acbab4c0092f346b156e1fe16db06302465d5 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 31 Mar 2025 10:36:50 -0700 Subject: [PATCH 06/63] Synchronize filter methods to match synconization on projector. --- .../main/java/org/apache/arrow/gandiva/evaluator/Filter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java index f584564e09..6c8540cde8 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java @@ -111,7 +111,7 @@ public static Filter make(Schema schema, Condition condition, boolean optimize) * @param configurationId Custom configuration created through config builder. * @return A native evaluator object that can be used to invoke these projections on a RecordBatch */ - public static Filter make(Schema schema, Condition condition, long configurationId) + public static synchronized Filter make(Schema schema, Condition condition, long configurationId) throws GandivaException { // Invoke the JNI layer to create the LLVM module representing the filter. GandivaTypes.Condition conditionBuf = condition.toProtobuf(); @@ -158,7 +158,7 @@ public void evaluate(int numRows, List buffers, SelectionVector select evaluate(numRows, buffers, buffersLayout, selectionVector); } - private void evaluate( + private synchronized void evaluate( int numRows, List buffers, List buffersLayout, From 858b1137b7c71f8556fafc4a233ff036ec2c8c37 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 1 May 2025 16:52:19 -0700 Subject: [PATCH 07/63] Remove unused imports --- .../org/apache/arrow/gandiva/evaluator/FunctionSignature.java | 1 - .../java/org/apache/arrow/gandiva/expression/FunctionNode.java | 1 - 2 files changed, 2 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java index 66a795723e..912aa2a50c 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java @@ -19,7 +19,6 @@ import com.google.common.base.MoreObjects; import com.google.common.base.Objects; -import java.util.ArrayList; import java.util.List; import org.apache.arrow.vector.types.pojo.ArrowType; diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java index d88dcb5647..83427e1eee 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java @@ -18,7 +18,6 @@ import java.util.List; -import org.apache.arrow.flatbuf.Type; import org.apache.arrow.gandiva.exceptions.GandivaException; import org.apache.arrow.gandiva.ipc.GandivaTypes; import org.apache.arrow.vector.types.pojo.ArrowType; From c65101c99c9068aba7254515a4c55a65e3b6a483 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 1 May 2025 10:27:48 -0700 Subject: [PATCH 08/63] Add jarbuild to branch. --- .github/workflows/jarbuild.yml | 552 +++++++++++++++++++++++++++++++++ 1 file changed, 552 insertions(+) create mode 100644 .github/workflows/jarbuild.yml diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml new file mode 100644 index 0000000000..ae2981cd6d --- /dev/null +++ b/.github/workflows/jarbuild.yml @@ -0,0 +1,552 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: JarBuild +on: + workflow_dispatch: + inputs: + arrow_branch: + description: 'Arrow branch to build' + required: true + default: main + arrow_repo: + description: 'Arrow repository' + type: string + required: true + default: apache/arrow + release_tag_name: + description: 'release tag name' + type: string + required: true + +concurrency: + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true +permissions: + contents: read +jobs: + source: + name: Source + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + - name: Set env + run: echo "release_tag_name=$(echo $release_tag_name)" >> $GITHUB_ENV + - name: Prepare for tag + run: | + echo "${{github.event.inputs.release_tag_name}}" + ver=$(echo ${{github.event.inputs.release_tag_name}}) + version=${ver%-rc*} + version=${version#v} + rc=${ver#*-rc} + echo "VERSION=${version}" >> ${GITHUB_ENV} + echo "VERSION=${version}" + echo "RC=${rc}" >> ${GITHUB_ENV} + echo "RC=${rc}" + - name: Archive + run: | + id="apache-arrow-java-${VERSION}" + tar_gz="${id}.tar.gz" + echo "TAR_GZ=${tar_gz}" >> ${GITHUB_ENV} + git archive HEAD --prefix "${id}/" --output "${tar_gz}" + sha256sum "${tar_gz}" > "${tar_gz}.sha256" + sha512sum "${tar_gz}" > "${tar_gz}.sha512" + - name: Audit + run: | + dev/release/run_rat.sh "${TAR_GZ}" + - name: Upload source archive + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: release-source + path: | + apache-arrow-java-* + jni-linux: + name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} + runs-on: ${{ matrix.platform.runs_on }} + timeout-minutes: 120 + needs: + - source + strategy: + fail-fast: false + matrix: + platform: + - runs_on: ubuntu-latest + arch: "x86_64" + archery_arch: "amd64" + - runs_on: ubuntu-24.04-arm + arch: "aarch_64" + archery_arch: "arm64v8" + env: + # architecture name used for archery build + ARCH: ${{ matrix.platform.archery_arch }} + DOCKER_VOLUME_PREFIX: .docker/ + permissions: + contents: read + packages: write + steps: + - name: Download source archive + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: release-source + - name: Extract source archive + run: | + tar -xf apache-arrow-java-*.tar.gz --strip-components=1 + # - name: Download the latest Apache Arrow C++ + # if: github.event_name != 'schedule' + # run: | + # ci/scripts/download_cpp.sh + - name: Checkout Apache Arrow C++ + # if: github.event_name == 'schedule' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: ${{github.event.inputs.arrow_repo}} + ref: ${{github.event.inputs.arrow_branch}} + path: arrow + - name: Checkout apache/arrow-testing + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: apache/arrow-testing + path: arrow/testing + - name: Checkout apache/parquet-testing + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: apache/parquet-testing + path: arrow/cpp/submodules/parquet-testing + - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Cache + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .docker + key: jni-linux-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }} + restore-keys: jni-linux-${{ matrix.platform.arch }}- + - name: Build + run: | + docker compose run vcpkg-jni + - name: Push Docker image + if: success() && github.event_name == 'push' && github.repository == 'apache/arrow-java' && github.ref_name == 'main' + run: | + docker compose push vcpkg-jni + - name: Compress into single artifact to keep directory structure + run: tar -cvzf jni-linux-${{ matrix.platform.arch }}.tar.gz jni/ + - name: Upload artifacts + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: jni-linux-${{ matrix.platform.arch }} + path: jni-linux-${{ matrix.platform.arch }}.tar.gz + jni-macos: + name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} + runs-on: ${{ matrix.platform.runs_on }} + timeout-minutes: 45 + needs: + - source + strategy: + fail-fast: false + matrix: + platform: + - { runs_on: macos-13, arch: "x86_64"} + - { runs_on: macos-14, arch: "aarch_64" } + env: + MACOSX_DEPLOYMENT_TARGET: "14.0" + steps: + - name: Download source archive + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: release-source + - name: Extract source archive + run: | + tar -xf apache-arrow-java-*.tar.gz --strip-components=1 + # - name: Download the latest Apache Arrow C++ + # if: github.event_name != 'schedule' + # run: | + # ci/scripts/download_cpp.sh + - name: Checkout Apache Arrow C++ + # if: github.event_name == 'schedule' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: ${{github.event.inputs.arrow_repo}} + ref: ${{github.event.inputs.arrow_branch}} + path: arrow + - name: Checkout apache/arrow-testing + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: apache/arrow-testing + path: arrow/testing + - name: Checkout apache/parquet-testing + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: apache/parquet-testing + path: arrow/cpp/submodules/parquet-testing + - name: Set up Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + cache: 'pip' + python-version: 3.12 + - name: Install Archery + run: pip install -e arrow/dev/archery[all] + - name: Install dependencies + run: | + # We want to use llvm@14 to avoid shared z3 + # dependency. llvm@14 doesn't depend on z3 and llvm depends + # on z3. And Homebrew's z3 provides only shared library. It + # doesn't provides static z3 because z3's CMake doesn't accept + # building both shared and static libraries at once. + # See also: Z3_BUILD_LIBZ3_SHARED in + # https://github.com/Z3Prover/z3/blob/master/README-CMake.md + # + # If llvm is installed, Apache Arrow C++ uses llvm rather than + # llvm@14 because llvm is newer than llvm@14. + brew uninstall llvm || : + + # Ensure updating python@XXX with the "--overwrite" option. + # If python@XXX is updated without "--overwrite", it causes + # a conflict error. Because Python 3 installed not by + # Homebrew exists in /usr/local on GitHub Actions. If + # Homebrew's python@XXX is updated without "--overwrite", it + # tries to replace /usr/local/bin/2to3 and so on and causes + # a conflict error. + brew update + for python_package in $(brew list | grep python@); do + brew install --overwrite ${python_package} + done + brew install --overwrite python + + if [ "$(uname -m)" = "arm64" ]; then + # pkg-config formula is deprecated but it's still installed + # in GitHub Actions runner now. We can remove this once + # pkg-config formula is removed from GitHub Actions runner. + brew uninstall pkg-config || : + brew uninstall pkg-config@0.29.2 || : + fi + + brew bundle --file=arrow/cpp/Brewfile + # We want to link aws-sdk-cpp statically but Homebrew's + # aws-sdk-cpp provides only shared library. If we have + # Homebrew's aws-sdk-cpp, our build mix Homebrew's + # aws-sdk-cpp and bundled aws-sdk-cpp. We uninstall Homebrew's + # aws-sdk-cpp to ensure using only bundled aws-sdk-cpp. + brew uninstall aws-sdk-cpp + # We want to use bundled RE2 for static linking. If + # Homebrew's RE2 is installed, its header file may be used. + # We uninstall Homebrew's RE2 to ensure using bundled RE2. + brew uninstall grpc || : # gRPC depends on RE2 + brew uninstall grpc@1.54 || : # gRPC 1.54 may be installed too + brew uninstall re2 + # We want to use bundled Protobuf for static linking. If + # Homebrew's Protobuf is installed, its library file may be + # used on test We uninstall Homebrew's Protobuf to ensure using + # bundled Protobuf. + brew uninstall protobuf + + brew bundle --file=Brewfile + - name: Prepare ccache + run: | + echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} + - name: Cache ccache + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ccache + key: jni-macos-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }} + restore-keys: jni-macos-${{ matrix.platform.arch }}- + - name: Build + run: | + set -e + # make brew Java available to CMake + export JAVA_HOME=$(brew --prefix openjdk@11)/libexec/openjdk.jdk/Contents/Home + ci/scripts/jni_macos_build.sh . arrow build jni + - name: Compress into single artifact to keep directory structure + run: tar -cvzf jni-macos-${{ matrix.platform.arch }}.tar.gz jni/ + - name: Upload artifacts + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: jni-macos-${{ matrix.platform.arch }} + path: jni-macos-${{ matrix.platform.arch }}.tar.gz + jni-windows: + name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} + runs-on: ${{ matrix.platform.runs_on }} + timeout-minutes: 45 + needs: + - source + strategy: + fail-fast: false + matrix: + platform: + - runs_on: windows-2019 + arch: "x86_64" + steps: + - name: Download source archive + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: release-source + - name: Extract source archive + shell: bash + run: | + tar -xf apache-arrow-java-*.tar.gz --strip-components=1 + # - name: Download the latest Apache Arrow C++ + # if: github.event_name != 'schedule' + # shell: bash + # run: | + # ci/scripts/download_cpp.sh + - name: Checkout Apache Arrow C++ + # if: github.event_name == 'schedule' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: ${{github.event.inputs.arrow_repo}} + ref: ${{github.event.inputs.arrow_branch}} + path: arrow + - name: Set up Java + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 + with: + java-version: '11' + distribution: 'temurin' + - name: Download Timezone Database + shell: bash + run: | + arrow/ci/scripts/download_tz_database.sh + - name: Install ccache + shell: bash + run: | + env | sort + version=4.10.2 + base_name="ccache-${version}-windows-x86_64" + url="https://github.com/ccache/ccache/releases/download/v${version}/${base_name}.zip" + curl --fail --location --remote-name "${url}" + unzip "${base_name}.zip" + chmod +x "${base_name}/ccache.exe" + mv "${base_name}/ccache.exe" /usr/bin/ + rm -rf "${base_name}"{,.zip} + - name: Prepare ccache + shell: bash + run: | + echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} + - name: Cache ccache + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ccache + key: jni-windows-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }} + restore-keys: jni-windows-${{ matrix.platform.arch }}- + - name: Build + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + REM For ORC + set TZDIR=/c/msys64/usr/share/zoneinfo + bash -c "ci/scripts/jni_windows_build.sh . arrow build jni" + - name: Compress into single artifact to keep directory structure + shell: bash + run: tar -cvzf jni-windows-${{ matrix.platform.arch }}.tar.gz jni/ + - name: Upload artifacts + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: jni-windows-${{ matrix.platform.arch }} + path: jni-windows-${{ matrix.platform.arch }}.tar.gz + binaries: + name: Binaries + runs-on: ubuntu-latest + needs: + - jni-linux + - jni-macos + - jni-windows + steps: + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + path: artifacts + - name: Decompress artifacts + run: | + mv artifacts/*/*.tar.gz . + tar -xf apache-arrow-java-*.tar.gz --strip-components=1 + tar -xvzf jni-linux-x86_64.tar.gz + tar -xvzf jni-linux-aarch_64.tar.gz + tar -xvzf jni-macos-x86_64.tar.gz + tar -xvzf jni-macos-aarch_64.tar.gz + tar -xvzf jni-windows-x86_64.tar.gz + - name: Test that shared libraries exist + run: | + set -x + + test -f jni/arrow_cdata_jni/x86_64/libarrow_cdata_jni.so + test -f jni/arrow_dataset_jni/x86_64/libarrow_dataset_jni.so + test -f jni/arrow_orc_jni/x86_64/libarrow_orc_jni.so + test -f jni/gandiva_jni/x86_64/libgandiva_jni.so + + test -f jni/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.so + test -f jni/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.so + test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.so + test -f jni/gandiva_jni/aarch_64/libgandiva_jni.so + + test -f jni/arrow_cdata_jni/x86_64/libarrow_cdata_jni.dylib + test -f jni/arrow_dataset_jni/x86_64/libarrow_dataset_jni.dylib + test -f jni/arrow_orc_jni/x86_64/libarrow_orc_jni.dylib + test -f jni/gandiva_jni/x86_64/libgandiva_jni.dylib + + test -f jni/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.dylib + test -f jni/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.dylib + test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib + test -f jni/gandiva_jni/aarch_64/libgandiva_jni.dylib + + test -f jni/arrow_cdata_jni/x86_64/arrow_cdata_jni.dll + test -f jni/arrow_dataset_jni/x86_64/arrow_dataset_jni.dll + test -f jni/arrow_orc_jni/x86_64/arrow_orc_jni.dll + - name: Checkout apache/arrow-testing + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: apache/arrow-testing + path: testing + - name: Cache ~/.m2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ~/.m2 + key: binaries-build-${{ hashFiles('**/*.java', '**/pom.xml') }} + restore-keys: binaries-build- + - name: Build bundled JAR and docs + run: | + ci/scripts/jni_full_build.sh . jni binaries + - name: Prepare docs + run: | + mkdir -p docs + cp -a target/site/apidocs reference + tar -cvzf reference.tar.gz reference + - name: Upload binaries + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: release-binaries + path: binaries/* + - name: Upload docs + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: reference + path: reference.tar.gz + docs: + name: Docs + needs: + - binaries + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + cache: 'pip' + - name: Download source archive + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: release-source + - name: Download Javadocs + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: reference + - name: Extract source archive + run: | + tar -xf apache-arrow-java-*.tar.gz --strip-components=1 + - name: Build + run: | + cd docs + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + make html + tar -xf ../reference.tar.gz -C build/html + - name: Compress into single artifact to keep directory structure + run: tar -cvzf html.tar.gz -C docs/build html + - name: Upload artifacts + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: release-html + path: html.tar.gz + verify: + name: Verify + needs: + - binaries + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + steps: + - name: Download release artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + pattern: release-* + - name: Verify + run: | + mv release-source/* ./ + tar_gz=$(echo apache-arrow-java-*.tar.gz) + version=${tar_gz#apache-arrow-java-} + version=${version%.tar.gz} + # rc isn't used with VERIFY_DOWNLOAD=0 + if [ "${GITHUB_REF_TYPE}" = "tag" ]; then + rc="${GITHUB_REF_NAME#*-rc}" + else + rc=$(date +%Y%m%d) + fi + tar -xf ${tar_gz} + export VERIFY_DEFAULT=0 + export VERIFY_BINARY=1 + export VERIFY_SOURCE=1 + cd apache-arrow-java-${version} + mv ../${tar_gz}* ./ + mv ../release-binaries binaries + dev/release/verify_rc.sh "${version}" "${rc}" + upload: + name: Upload + needs: + - docs + - verify + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download release artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + pattern: release-* + path: artifacts + - name: Upload + run: | + # GH-499: How to create release notes? + echo "${{github.event.inputs.release_tag_name}}" + ver=$(echo ${{github.event.inputs.release_tag_name}}) + version=${ver%-rc*} + version=${version#v} + rc=${ver#*-rc} + gh release create ${{github.event.inputs.release_tag_name}} \ + --generate-notes \ + --prerelease \ + --repo ${GITHUB_REPOSITORY} \ + --title "Apache Arrow Java ${version} RC${rc}" \ + --verify-tag + # GitHub CLI does not respect their own rate limits + # https://github.com/cli/cli/issues/9586 + for artifact in artifacts/*/*; do + sleep 1 + gh release upload ${{github.event.inputs.release_tag_name}} \ + --repo ${GITHUB_REPOSITORY} \ + $artifact + done + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 62d0d6b00d2a6087fbf425d03480d83aa91aec5e Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 2 May 2025 10:33:02 -0700 Subject: [PATCH 09/63] Run spotless --- .../org/apache/arrow/gandiva/evaluator/FunctionSignature.java | 1 - .../java/org/apache/arrow/gandiva/evaluator/JniLoader.java | 3 --- .../java/org/apache/arrow/gandiva/expression/FunctionNode.java | 1 - 3 files changed, 5 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java index 912aa2a50c..164b6aaac6 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java @@ -18,7 +18,6 @@ import com.google.common.base.MoreObjects; import com.google.common.base.Objects; - import java.util.List; import org.apache.arrow.vector.types.pojo.ArrowType; diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java index ae7deaa036..5c59c219ea 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java @@ -31,9 +31,6 @@ import java.util.concurrent.ConcurrentMap; import org.apache.arrow.gandiva.exceptions.GandivaException; -import com.sun.jna.Library; -import com.sun.jna.NativeLibrary; - /** This class handles loading of the jni library, and acts as a bridge for the native functions. */ class JniLoader { private static final String LIBRARY_NAME = "gandiva_jni"; diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java index 83427e1eee..a5c6fb77f9 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java @@ -17,7 +17,6 @@ package org.apache.arrow.gandiva.expression; import java.util.List; - import org.apache.arrow.gandiva.exceptions.GandivaException; import org.apache.arrow.gandiva.ipc.GandivaTypes; import org.apache.arrow.vector.types.pojo.ArrowType; From 250eb1c9be16ab5b7ede3ec8c0f229b466b9983b Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 3 Jul 2025 08:27:05 -0700 Subject: [PATCH 10/63] Remove dll --- .github/workflows/jarbuild.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index ae2981cd6d..1ce92bf3b3 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -406,9 +406,6 @@ jobs: test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib test -f jni/gandiva_jni/aarch_64/libgandiva_jni.dylib - test -f jni/arrow_cdata_jni/x86_64/arrow_cdata_jni.dll - test -f jni/arrow_dataset_jni/x86_64/arrow_dataset_jni.dll - test -f jni/arrow_orc_jni/x86_64/arrow_orc_jni.dll - name: Checkout apache/arrow-testing uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: From 89bac7fae5156cc635e399aa6760b6da872ed9b4 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 2 Jul 2025 16:46:33 -0700 Subject: [PATCH 11/63] Remove windows jar build. --- .github/workflows/jarbuild.yml | 81 ---------------------------------- 1 file changed, 81 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 1ce92bf3b3..e93fc4d439 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -282,92 +282,12 @@ jobs: with: name: jni-macos-${{ matrix.platform.arch }} path: jni-macos-${{ matrix.platform.arch }}.tar.gz - jni-windows: - name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} - runs-on: ${{ matrix.platform.runs_on }} - timeout-minutes: 45 - needs: - - source - strategy: - fail-fast: false - matrix: - platform: - - runs_on: windows-2019 - arch: "x86_64" - steps: - - name: Download source archive - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: release-source - - name: Extract source archive - shell: bash - run: | - tar -xf apache-arrow-java-*.tar.gz --strip-components=1 - # - name: Download the latest Apache Arrow C++ - # if: github.event_name != 'schedule' - # shell: bash - # run: | - # ci/scripts/download_cpp.sh - - name: Checkout Apache Arrow C++ - # if: github.event_name == 'schedule' - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - repository: ${{github.event.inputs.arrow_repo}} - ref: ${{github.event.inputs.arrow_branch}} - path: arrow - - name: Set up Java - uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 - with: - java-version: '11' - distribution: 'temurin' - - name: Download Timezone Database - shell: bash - run: | - arrow/ci/scripts/download_tz_database.sh - - name: Install ccache - shell: bash - run: | - env | sort - version=4.10.2 - base_name="ccache-${version}-windows-x86_64" - url="https://github.com/ccache/ccache/releases/download/v${version}/${base_name}.zip" - curl --fail --location --remote-name "${url}" - unzip "${base_name}.zip" - chmod +x "${base_name}/ccache.exe" - mv "${base_name}/ccache.exe" /usr/bin/ - rm -rf "${base_name}"{,.zip} - - name: Prepare ccache - shell: bash - run: | - echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} - - name: Cache ccache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: ccache - key: jni-windows-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }} - restore-keys: jni-windows-${{ matrix.platform.arch }}- - - name: Build - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - REM For ORC - set TZDIR=/c/msys64/usr/share/zoneinfo - bash -c "ci/scripts/jni_windows_build.sh . arrow build jni" - - name: Compress into single artifact to keep directory structure - shell: bash - run: tar -cvzf jni-windows-${{ matrix.platform.arch }}.tar.gz jni/ - - name: Upload artifacts - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - with: - name: jni-windows-${{ matrix.platform.arch }} - path: jni-windows-${{ matrix.platform.arch }}.tar.gz binaries: name: Binaries runs-on: ubuntu-latest needs: - jni-linux - jni-macos - - jni-windows steps: - name: Download artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 @@ -381,7 +301,6 @@ jobs: tar -xvzf jni-linux-aarch_64.tar.gz tar -xvzf jni-macos-x86_64.tar.gz tar -xvzf jni-macos-aarch_64.tar.gz - tar -xvzf jni-windows-x86_64.tar.gz - name: Test that shared libraries exist run: | set -x From bd56f0257d4a72fea4e76a6dc0c40d683316bf2c Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Tue, 15 Jul 2025 09:14:49 -0700 Subject: [PATCH 12/63] Remove sync --- .../java/org/apache/arrow/gandiva/evaluator/Projector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java index 9c5b22d659..5c16c46e5e 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java @@ -188,7 +188,7 @@ public static Projector make( * @param configurationId Custom configuration created through config builder. * @return A native evaluator object that can be used to invoke these projections on a RecordBatch */ - public static synchronized Projector make( + public static Projector make( Schema schema, List exprs, SelectionVectorType selectionVectorType, @@ -314,7 +314,7 @@ public void evaluate( outColumns); } - private synchronized void evaluate( + private void evaluate( int numRows, List buffers, List buffersLayout, From 0f885642dfda0bf9d56db6bd7280a86aec979488 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 4 Aug 2025 14:55:45 -0700 Subject: [PATCH 13/63] Reinstate DX-90092 --- .../org/apache/arrow/memory/BaseAllocator.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java b/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java index 72946e7fb7..5ed1c7da54 100644 --- a/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java +++ b/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java @@ -432,6 +432,20 @@ public AllocationReservation newReservation() { @Override public synchronized void close() { + try { + closeImpl(); + } catch (Exception e) { + logger.warn( + "BufferAllocator.close() of {} got an exception {} - Details {}", + this, + e, + this.toVerboseString()); + + throw e; + } + } + + private synchronized void closeImpl() { /* * Some owners may close more than once because of complex cleanup and shutdown * procedures. From 2b68c10f94144ce05493cddd2477c6e4a27d2008 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 4 Aug 2025 15:44:07 -0700 Subject: [PATCH 14/63] spotless --- .../java/org/apache/arrow/memory/BaseAllocator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java b/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java index 5ed1c7da54..1a591cca08 100644 --- a/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java +++ b/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java @@ -436,12 +436,12 @@ public synchronized void close() { closeImpl(); } catch (Exception e) { logger.warn( - "BufferAllocator.close() of {} got an exception {} - Details {}", - this, - e, - this.toVerboseString()); + "BufferAllocator.close() of {} got an exception {} - Details {}", + this, + e, + this.toVerboseString()); - throw e; + throw e; } } From ac5ee61d93b6cf19cbfb8752a130fee292105e24 Mon Sep 17 00:00:00 2001 From: Logan Date: Mon, 4 Aug 2025 16:47:13 -0700 Subject: [PATCH 15/63] Update substrait.rst --- docs/source/substrait.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/substrait.rst b/docs/source/substrait.rst index 5ec07f1658..1d9c774fe0 100644 --- a/docs/source/substrait.rst +++ b/docs/source/substrait.rst @@ -19,7 +19,8 @@ Substrait ========= -The ``arrow-dataset`` module can execute Substrait_ plans via the :external+arrow:doc:`Acero ` +The ``arrow-dataset`` module can execute Substrait_ plans via the Acero + query engine. Executing Queries Using Substrait Plans From 9f8d0dd8e63269f680342d22f58a5a62aa373ae2 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 15 Aug 2025 14:55:52 -0700 Subject: [PATCH 16/63] Revert "Remove sync" This reverts commit b9d277882134d26d0b1e297f1d6293d2ae59bd36. --- .../java/org/apache/arrow/gandiva/evaluator/Projector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java index 5c16c46e5e..9c5b22d659 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java @@ -188,7 +188,7 @@ public static Projector make( * @param configurationId Custom configuration created through config builder. * @return A native evaluator object that can be used to invoke these projections on a RecordBatch */ - public static Projector make( + public static synchronized Projector make( Schema schema, List exprs, SelectionVectorType selectionVectorType, @@ -314,7 +314,7 @@ public void evaluate( outColumns); } - private void evaluate( + private synchronized void evaluate( int numRows, List buffers, List buffersLayout, From d621f8488f3ceb0bf832f247a7c5e0a2f02e5169 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 15 Sep 2025 14:20:43 -0700 Subject: [PATCH 17/63] Update jar build for mac os versions --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index e93fc4d439..857ce1832f 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,7 +165,7 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: macos-13, arch: "x86_64"} + - { runs_on: macos-14, arch: "x86_64"} - { runs_on: macos-14, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" From 497017d4af139989cd1b160a62985524faa5f85e Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 15 Sep 2025 15:04:30 -0700 Subject: [PATCH 18/63] Update jar build for mac os versions --- .github/workflows/jarbuild.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 857ce1832f..0bfa48893f 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,7 +165,6 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: macos-14, arch: "x86_64"} - { runs_on: macos-14, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" @@ -299,7 +298,6 @@ jobs: tar -xf apache-arrow-java-*.tar.gz --strip-components=1 tar -xvzf jni-linux-x86_64.tar.gz tar -xvzf jni-linux-aarch_64.tar.gz - tar -xvzf jni-macos-x86_64.tar.gz tar -xvzf jni-macos-aarch_64.tar.gz - name: Test that shared libraries exist run: | @@ -315,11 +313,6 @@ jobs: test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.so test -f jni/gandiva_jni/aarch_64/libgandiva_jni.so - test -f jni/arrow_cdata_jni/x86_64/libarrow_cdata_jni.dylib - test -f jni/arrow_dataset_jni/x86_64/libarrow_dataset_jni.dylib - test -f jni/arrow_orc_jni/x86_64/libarrow_orc_jni.dylib - test -f jni/gandiva_jni/x86_64/libgandiva_jni.dylib - test -f jni/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.dylib test -f jni/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.dylib test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib From 8ff20e4aad8cd131350d1b1f921157aa226965d7 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Tue, 7 Oct 2025 14:39:23 -0700 Subject: [PATCH 19/63] test installing llvm via script --- ci/scripts/jni_manylinux_build.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index 3577c37ab3..810feb9c3c 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -25,6 +25,22 @@ set -euo pipefail # shellcheck source=ci/scripts/util_log.sh . "$(dirname "${0}")/util_log.sh" +github_actions_group_begin "Update llvm" + vcpkg install \ + --debug \ + --clean-after-build \ + --x-install-root=${VCPKG_ROOT}/installed \ + --x-manifest-root=/arrow/ci/vcpkg \ + --overlay-ports=/arrow/ci/vcpkg/overlay/llvm/ \ + --x-feature=dev \ + --x-feature=flight \ + --x-feature=gcs \ + --x-feature=json \ + --x-feature=parquet \ + --x-feature=gandiva \ + --x-feature=s3 +github_actions_group_end + github_actions_group_begin "Prepare arguments" source_dir="$(cd "${1}" && pwd)" arrow_dir="$(cd "${2}" && pwd)" From dc5f1e414d65d77b109d234225a0ba01e485a2fb Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 8 Oct 2025 09:22:33 -0700 Subject: [PATCH 20/63] increase timeout --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 0bfa48893f..cd1c4fc45f 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -81,7 +81,7 @@ jobs: jni-linux: name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} runs-on: ${{ matrix.platform.runs_on }} - timeout-minutes: 120 + timeout-minutes: 240 needs: - source strategy: From e1a4448e7536996160da3ecf6aaf61008f96b990 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 15 Oct 2025 09:29:43 -0700 Subject: [PATCH 21/63] Revert "Update jar build for mac os versions" This reverts commit 91517224936e102315e470350929c099adf6b202. --- .github/workflows/jarbuild.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index cd1c4fc45f..967e4aaacb 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,6 +165,7 @@ jobs: fail-fast: false matrix: platform: + - { runs_on: macos-14, arch: "x86_64"} - { runs_on: macos-14, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" @@ -298,6 +299,7 @@ jobs: tar -xf apache-arrow-java-*.tar.gz --strip-components=1 tar -xvzf jni-linux-x86_64.tar.gz tar -xvzf jni-linux-aarch_64.tar.gz + tar -xvzf jni-macos-x86_64.tar.gz tar -xvzf jni-macos-aarch_64.tar.gz - name: Test that shared libraries exist run: | @@ -313,6 +315,11 @@ jobs: test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.so test -f jni/gandiva_jni/aarch_64/libgandiva_jni.so + test -f jni/arrow_cdata_jni/x86_64/libarrow_cdata_jni.dylib + test -f jni/arrow_dataset_jni/x86_64/libarrow_dataset_jni.dylib + test -f jni/arrow_orc_jni/x86_64/libarrow_orc_jni.dylib + test -f jni/gandiva_jni/x86_64/libgandiva_jni.dylib + test -f jni/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.dylib test -f jni/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.dylib test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib From 8ced98336f1670be0971bfb18a73d8a6895640a8 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 15 Oct 2025 09:36:00 -0700 Subject: [PATCH 22/63] macos 14 x86 --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 967e4aaacb..0aa5bac890 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,7 +165,7 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: macos-14, arch: "x86_64"} + - { runs_on: macos-14-large, arch: "x86_64"} - { runs_on: macos-14, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" From 180394c0d57f968a2ffbd7b8e6162dc1c01e93fb Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 15 Oct 2025 09:49:31 -0700 Subject: [PATCH 23/63] macos 14 x86 --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 0aa5bac890..10e51c2fb4 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,7 +165,7 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: macos-14-large, arch: "x86_64"} + - { runs_on: macos-15-intel, arch: "x86_64"} - { runs_on: macos-14, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" From 45f31a0e4b6adda69dd49593ebf0e68e33554b29 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 30 Oct 2025 11:00:41 -0700 Subject: [PATCH 24/63] DX-110305 Use vcpkg on mac builds to install llvm. This removes the z3 runtime dependency and ensures a consistent version of llvm with the linux builds. --- .github/workflows/jarbuild.yml | 41 ++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 10e51c2fb4..fee6999d7d 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -158,7 +158,7 @@ jobs: jni-macos: name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} runs-on: ${{ matrix.platform.runs_on }} - timeout-minutes: 45 + timeout-minutes: 445 needs: - source strategy: @@ -166,7 +166,7 @@ jobs: matrix: platform: - { runs_on: macos-15-intel, arch: "x86_64"} - - { runs_on: macos-14, arch: "aarch_64" } + - { runs_on: macos-15, arch: "aarch_64" } env: MACOSX_DEPLOYMENT_TARGET: "14.0" steps: @@ -205,20 +205,19 @@ jobs: python-version: 3.12 - name: Install Archery run: pip install -e arrow/dev/archery[all] + - name: Checkout vcpkg + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: Microsoft/vcpkg + path: arrow/cpp/submodules/vcpkg + - name: Install vcpkg + run: | + cd arrow/cpp/submodules/vcpkg + ./bootstrap-vcpkg.sh + echo "VCPKG_ROOT=${PWD}/arrow/cpp/submodules/vcpkg" >> ${GITHUB_ENV} + echo "${PWD}/arrow/cpp/submodules/vcpkg" >> ${GITHUB_PATH} - name: Install dependencies run: | - # We want to use llvm@14 to avoid shared z3 - # dependency. llvm@14 doesn't depend on z3 and llvm depends - # on z3. And Homebrew's z3 provides only shared library. It - # doesn't provides static z3 because z3's CMake doesn't accept - # building both shared and static libraries at once. - # See also: Z3_BUILD_LIBZ3_SHARED in - # https://github.com/Z3Prover/z3/blob/master/README-CMake.md - # - # If llvm is installed, Apache Arrow C++ uses llvm rather than - # llvm@14 because llvm is newer than llvm@14. - brew uninstall llvm || : - # Ensure updating python@XXX with the "--overwrite" option. # If python@XXX is updated without "--overwrite", it causes # a conflict error. Because Python 3 installed not by @@ -240,7 +239,13 @@ jobs: brew uninstall pkg-config@0.29.2 || : fi + # Install basic build tools via brew (vcpkg needs these) + brew install cmake ninja pkg-config brew bundle --file=arrow/cpp/Brewfile + + # Clean up any existing LLVM installations in favor of vcpkg. + brew uninstall llvm || : + # We want to link aws-sdk-cpp statically but Homebrew's # aws-sdk-cpp provides only shared library. If we have # Homebrew's aws-sdk-cpp, our build mix Homebrew's @@ -259,6 +264,14 @@ jobs: # bundled Protobuf. brew uninstall protobuf + # Use vcpkg to install LLVM. + vcpkg install \ + --clean-after-build \ + --x-install-root=${VCPKG_ROOT}/installed \ + --x-manifest-root=arrow/ci/vcpkg \ + --overlay-ports=arrow/ci/vcpkg/overlay/llvm/ \ + --x-feature=gandiva-llvm + brew bundle --file=Brewfile - name: Prepare ccache run: | From 0bd0072fc60d08e5bb02960b04d5ce0e0e7aa55a Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 30 Oct 2025 16:59:36 -0700 Subject: [PATCH 25/63] vcpkg: move checked out repo to avoid long running hash operation. --- .github/workflows/jarbuild.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index fee6999d7d..0e9908b151 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -209,13 +209,13 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: repository: Microsoft/vcpkg - path: arrow/cpp/submodules/vcpkg + path: arrow/vcpkg - name: Install vcpkg run: | - cd arrow/cpp/submodules/vcpkg + cd arrow/vcpkg ./bootstrap-vcpkg.sh - echo "VCPKG_ROOT=${PWD}/arrow/cpp/submodules/vcpkg" >> ${GITHUB_ENV} - echo "${PWD}/arrow/cpp/submodules/vcpkg" >> ${GITHUB_PATH} + echo "VCPKG_ROOT=${PWD}/arrow/vcpkg" >> ${GITHUB_ENV} + echo "${PWD}/arrow/vcpkg" >> ${GITHUB_PATH} - name: Install dependencies run: | # Ensure updating python@XXX with the "--overwrite" option. From b21b34d8d54137523d9af9fe358b132ffb2c2636 Mon Sep 17 00:00:00 2001 From: Tim Hurski Date: Wed, 17 Dec 2025 14:14:07 -0500 Subject: [PATCH 26/63] MINOR: Remove macOS 15 build target (#10) * Free up space before installing dependencies * Bump macOS development target * Remove macOS x86_64 build --- .github/workflows/jarbuild.yml | 51 ++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 0e9908b151..e97b8978a5 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -165,10 +165,9 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: macos-15-intel, arch: "x86_64"} - { runs_on: macos-15, arch: "aarch_64" } env: - MACOSX_DEPLOYMENT_TARGET: "14.0" + MACOSX_DEPLOYMENT_TARGET: "15.0" steps: - name: Download source archive uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 @@ -216,8 +215,30 @@ jobs: ./bootstrap-vcpkg.sh echo "VCPKG_ROOT=${PWD}/arrow/vcpkg" >> ${GITHUB_ENV} echo "${PWD}/arrow/vcpkg" >> ${GITHUB_PATH} + - name: Clean up disk space + run: | + echo "=== Free disk space before cleanup ===" + df -h / + + echo "" + echo "=== Removing Xcode simulators ===" + sudo rm -rf /Library/Developer/CoreSimulator/Caches || : + echo "Removed /Library/Developer/CoreSimulator/Caches" + + echo "" + echo "=== Removing user simulator data ===" + rm -rf ~/Library/Developer/CoreSimulator || : + echo "Removed ~/Library/Developer/CoreSimulator" + + echo "" + echo "=== Free disk space after cleanup ===" + df -h / - name: Install dependencies run: | + echo "=== Free disk space at start of dependency installation ===" + df -h / + + echo "" # Ensure updating python@XXX with the "--overwrite" option. # If python@XXX is updated without "--overwrite", it causes # a conflict error. Because Python 3 installed not by @@ -264,6 +285,11 @@ jobs: # bundled Protobuf. brew uninstall protobuf + echo "" + echo "=== Free disk space before LLVM build ===" + df -h / + + echo "" # Use vcpkg to install LLVM. vcpkg install \ --clean-after-build \ @@ -271,7 +297,12 @@ jobs: --x-manifest-root=arrow/ci/vcpkg \ --overlay-ports=arrow/ci/vcpkg/overlay/llvm/ \ --x-feature=gandiva-llvm - + + echo "" + echo "=== Free disk space after LLVM build ===" + df -h / + + echo "" brew bundle --file=Brewfile - name: Prepare ccache run: | @@ -284,10 +315,18 @@ jobs: restore-keys: jni-macos-${{ matrix.platform.arch }}- - name: Build run: | + echo "=== Free disk space at start of build ===" + df -h / + + echo "" set -e # make brew Java available to CMake export JAVA_HOME=$(brew --prefix openjdk@11)/libexec/openjdk.jdk/Contents/Home ci/scripts/jni_macos_build.sh . arrow build jni + + echo "" + echo "=== Free disk space at end of build ===" + df -h / - name: Compress into single artifact to keep directory structure run: tar -cvzf jni-macos-${{ matrix.platform.arch }}.tar.gz jni/ - name: Upload artifacts @@ -312,7 +351,6 @@ jobs: tar -xf apache-arrow-java-*.tar.gz --strip-components=1 tar -xvzf jni-linux-x86_64.tar.gz tar -xvzf jni-linux-aarch_64.tar.gz - tar -xvzf jni-macos-x86_64.tar.gz tar -xvzf jni-macos-aarch_64.tar.gz - name: Test that shared libraries exist run: | @@ -328,11 +366,6 @@ jobs: test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.so test -f jni/gandiva_jni/aarch_64/libgandiva_jni.so - test -f jni/arrow_cdata_jni/x86_64/libarrow_cdata_jni.dylib - test -f jni/arrow_dataset_jni/x86_64/libarrow_dataset_jni.dylib - test -f jni/arrow_orc_jni/x86_64/libarrow_orc_jni.dylib - test -f jni/gandiva_jni/x86_64/libgandiva_jni.dylib - test -f jni/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.dylib test -f jni/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.dylib test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib From 7d5e331edf1173a059995ad5b3351005b1b2c5d2 Mon Sep 17 00:00:00 2001 From: Ivan Chesnov Date: Thu, 18 Dec 2025 11:20:37 +0200 Subject: [PATCH 27/63] Add cleanup step in jarbuild workflow Added a step to remove logs and unused SDKs to clean up the environment. --- .github/workflows/jarbuild.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index e97b8978a5..3272f189d2 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -215,6 +215,12 @@ jobs: ./bootstrap-vcpkg.sh echo "VCPKG_ROOT=${PWD}/arrow/vcpkg" >> ${GITHUB_ENV} echo "${PWD}/arrow/vcpkg" >> ${GITHUB_PATH} + - name: Remove logs and unused SDKs + run: | + sudo rm -rf /usr/local/share/vcpkg/buildtrees + sudo rm -rf /Applications/Xcode*/Contents/Developer/Platforms/iPhone* + sudo rm -rf /Library/Developer/CoreSimulator/Caches/* + df -h - name: Clean up disk space run: | echo "=== Free disk space before cleanup ===" From d32fd045da80ba652d3c1ca65c7aa327bf7dcc3a Mon Sep 17 00:00:00 2001 From: Ivan Chesnov Date: Thu, 18 Dec 2025 13:51:33 +0200 Subject: [PATCH 28/63] fix --- .github/workflows/jarbuild.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 3272f189d2..b21c58fd39 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -16,7 +16,7 @@ # under the License. name: JarBuild -on: +on: workflow_dispatch: inputs: arrow_branch: @@ -215,12 +215,6 @@ jobs: ./bootstrap-vcpkg.sh echo "VCPKG_ROOT=${PWD}/arrow/vcpkg" >> ${GITHUB_ENV} echo "${PWD}/arrow/vcpkg" >> ${GITHUB_PATH} - - name: Remove logs and unused SDKs - run: | - sudo rm -rf /usr/local/share/vcpkg/buildtrees - sudo rm -rf /Applications/Xcode*/Contents/Developer/Platforms/iPhone* - sudo rm -rf /Library/Developer/CoreSimulator/Caches/* - df -h - name: Clean up disk space run: | echo "=== Free disk space before cleanup ===" From f7b14ae2b26959ae3765e7420863bc45cfe174d1 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 19 Dec 2025 16:40:00 -0800 Subject: [PATCH 29/63] Add logging for jarbuild action parameters. --- .github/workflows/jarbuild.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index b21c58fd39..2f9d1f73ff 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -44,6 +44,11 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - name: Print input values to log + run: | + echo "arrow_branch: ${{github.event.inputs.arrow_branch}}" + echo "arrow_repo: ${{github.event.inputs.arrow_repo}}" + echo "release_tag_name: ${{github.event.inputs.release_tag_name}}" - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: From 02934809335db34444afd2baf0b672662bf3b324 Mon Sep 17 00:00:00 2001 From: "selva.govindarajan" Date: Thu, 29 Jan 2026 09:16:28 -0800 Subject: [PATCH 30/63] MINOR: [Java] Make StructVector.reallocValidityBuffer protected [Java] Make StructVector.reallocValidityBuffer protected Changes the access modifier of reallocValidityBuffer from package-private to protected. This allows subclasses to reallocate the validity buffer independently of the struct elements. Previously, expanding the validity buffer required a full vector reallocation, which could cause an OversizedAllocationException if the child data vectors were already near their capacity. --- .../main/java/org/apache/arrow/vector/complex/StructVector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java index 5e5bb7fc21..21ea9c6f05 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java @@ -529,7 +529,7 @@ public void reAlloc() { super.reAlloc(); } - private void reallocValidityBuffer() { + protected void reallocValidityBuffer() { final int currentBufferCapacity = checkedCastToInt(validityBuffer.capacity()); long newAllocationSize = getNewAllocationSize(currentBufferCapacity); From 8a411ea67eb1b3eb4de584dc8494a590c4358d25 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 2 Feb 2026 15:37:17 -0800 Subject: [PATCH 31/63] Change release naming scheme to add commit ids. --- .github/workflows/jarbuild.yml | 59 ++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 2f9d1f73ff..f82dac9104 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -488,30 +488,71 @@ jobs: permissions: contents: write steps: + - name: Checkout arrow-java repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout Apache Arrow C++ repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: ${{github.event.inputs.arrow_repo}} + ref: ${{github.event.inputs.arrow_branch}} + path: arrow + - name: Get commit IDs + id: commit_ids + run: | + # Get short commit ID for arrow-java + arrow_java_commit=$(git rev-parse --short HEAD) + echo "arrow_java_commit=${arrow_java_commit}" >> $GITHUB_OUTPUT + + # Get short commit ID for arrow + cd arrow + arrow_commit=$(git rev-parse --short HEAD) + echo "arrow_commit=${arrow_commit}" >> $GITHUB_OUTPUT + cd .. + + # Parse version from release tag + ver=$(echo ${{github.event.inputs.release_tag_name}}) + version=${ver%-rc*} + version=${version#v} + rc=${ver#*-rc} + + # Create release name with both commit IDs + release_name="${version}-${arrow_java_commit}-${arrow_commit}" + release_tag="v${release_name}" + echo "release_name=${release_name}" >> $GITHUB_OUTPUT + echo "release_tag=${release_tag}" >> $GITHUB_OUTPUT + echo "version=${version}" >> $GITHUB_OUTPUT + echo "rc=${rc}" >> $GITHUB_OUTPUT + + echo "Arrow Java commit: ${arrow_java_commit}" + echo "Arrow commit: ${arrow_commit}" + echo "Release tag: ${release_tag}" - name: Download release artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: pattern: release-* path: artifacts + - name: Create and push tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "${{ steps.commit_ids.outputs.release_tag }}" -m "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}" + git push origin "${{ steps.commit_ids.outputs.release_tag }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload run: | # GH-499: How to create release notes? - echo "${{github.event.inputs.release_tag_name}}" - ver=$(echo ${{github.event.inputs.release_tag_name}}) - version=${ver%-rc*} - version=${version#v} - rc=${ver#*-rc} - gh release create ${{github.event.inputs.release_tag_name}} \ + echo "Creating release: ${{ steps.commit_ids.outputs.release_tag }}" + gh release create "${{ steps.commit_ids.outputs.release_tag }}" \ --generate-notes \ --prerelease \ --repo ${GITHUB_REPOSITORY} \ - --title "Apache Arrow Java ${version} RC${rc}" \ - --verify-tag + --title "Apache Arrow Java ${{ steps.commit_ids.outputs.version }} RC${{ steps.commit_ids.outputs.rc }} (arrow-java: ${{ steps.commit_ids.outputs.arrow_java_commit }}, arrow: ${{ steps.commit_ids.outputs.arrow_commit }})" # GitHub CLI does not respect their own rate limits # https://github.com/cli/cli/issues/9586 for artifact in artifacts/*/*; do sleep 1 - gh release upload ${{github.event.inputs.release_tag_name}} \ + gh release upload "${{ steps.commit_ids.outputs.release_tag }}" \ --repo ${GITHUB_REPOSITORY} \ $artifact done From 1f80e329e78ca2b20868afea01845c0851f69447 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 5 Feb 2026 12:04:21 -0800 Subject: [PATCH 32/63] Add action url to release --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index f82dac9104..db7f622b18 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -544,7 +544,7 @@ jobs: # GH-499: How to create release notes? echo "Creating release: ${{ steps.commit_ids.outputs.release_tag }}" gh release create "${{ steps.commit_ids.outputs.release_tag }}" \ - --generate-notes \ + -n "Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ --prerelease \ --repo ${GITHUB_REPOSITORY} \ --title "Apache Arrow Java ${{ steps.commit_ids.outputs.version }} RC${{ steps.commit_ids.outputs.rc }} (arrow-java: ${{ steps.commit_ids.outputs.arrow_java_commit }}, arrow: ${{ steps.commit_ids.outputs.arrow_commit }})" From 2662d787ef4dce1daa3c40723995d009c7f42751 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 5 Feb 2026 09:52:59 -0800 Subject: [PATCH 33/63] Add action url to release --- .github/workflows/jarbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index db7f622b18..e0de53116d 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -535,7 +535,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git tag -a "${{ steps.commit_ids.outputs.release_tag }}" -m "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}" + git tag -a "${{ steps.commit_ids.outputs.release_tag }}" -m "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}" -m "Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" git push origin "${{ steps.commit_ids.outputs.release_tag }}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -544,7 +544,7 @@ jobs: # GH-499: How to create release notes? echo "Creating release: ${{ steps.commit_ids.outputs.release_tag }}" gh release create "${{ steps.commit_ids.outputs.release_tag }}" \ - -n "Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ + --notes-from-tag \ --prerelease \ --repo ${GITHUB_REPOSITORY} \ --title "Apache Arrow Java ${{ steps.commit_ids.outputs.version }} RC${{ steps.commit_ids.outputs.rc }} (arrow-java: ${{ steps.commit_ids.outputs.arrow_java_commit }}, arrow: ${{ steps.commit_ids.outputs.arrow_commit }})" From 24b0ab5c3d843a5269e3cbc9feb0876ef7f783ef Mon Sep 17 00:00:00 2001 From: Tim Hurski Date: Fri, 13 Feb 2026 19:12:26 -0500 Subject: [PATCH 34/63] Trim & print run parameters (#15) --- .github/workflows/jarbuild.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index e0de53116d..2d2068d658 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -44,21 +44,35 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: Print input values to log + - name: Trim workflow inputs run: | - echo "arrow_branch: ${{github.event.inputs.arrow_branch}}" - echo "arrow_repo: ${{github.event.inputs.arrow_repo}}" - echo "release_tag_name: ${{github.event.inputs.release_tag_name}}" + echo "ARROW_BRANCH=$(echo '${{github.event.inputs.arrow_branch}}' | xargs)" >> $GITHUB_ENV + echo "ARROW_REPO=$(echo '${{github.event.inputs.arrow_repo}}' | xargs)" >> $GITHUB_ENV + echo "RELEASE_TAG_NAME=$(echo '${{github.event.inputs.release_tag_name}}' | xargs)" >> $GITHUB_ENV + - name: Print workflow input parameters + run: | + echo "==========================================" + echo "Workflow Input Parameters" + echo "==========================================" + echo "arrow_branch: ${{env.ARROW_BRANCH}}" + echo "arrow_repo: ${{env.ARROW_REPO}}" + echo "release_tag_name: ${{env.RELEASE_TAG_NAME}}" + echo "arrow-java branch: ${{github.ref_name}}" + echo "" + echo "Direct Links:" + echo "----------------------------------------" + echo "Arrow C++ repo/branch: https://github.com/${{env.ARROW_REPO}}/tree/${{env.ARROW_BRANCH}}" + echo "Arrow Java repo/branch: https://github.com/${{github.repository}}/tree/${{github.ref_name}}" + echo "Release tag: https://github.com/${{github.repository}}/releases/tag/${{env.RELEASE_TAG_NAME}}" + echo "==========================================" - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: recursive - - name: Set env - run: echo "release_tag_name=$(echo $release_tag_name)" >> $GITHUB_ENV - name: Prepare for tag run: | - echo "${{github.event.inputs.release_tag_name}}" - ver=$(echo ${{github.event.inputs.release_tag_name}}) + echo "${{env.RELEASE_TAG_NAME}}" + ver=$(echo ${{env.RELEASE_TAG_NAME}}) version=${ver%-rc*} version=${version#v} rc=${ver#*-rc} From d873d6e5f16c0899be2466dc3326b0e576785662 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 23 Feb 2026 20:04:05 -0800 Subject: [PATCH 35/63] DX-114802: Fix Mac build to actually use VCPKG for LLVM. (#16) * Change release naming scheme to add commit ids. Add action url to release Add action url to release * Mac vcpkg root setting. Old grpc uninstall causing error? fix vcpkg root error Fix vcpgkg llvm for mac. vcpkg vcpkg Go back to brew for build tools. vcpkg just for llvm Update macos path fix path to system files vcpkg vcpkg vcpkg fix re2 dependency Make JNI CMake args more robust - Check if protobuf_ep-install exists before adding Protobuf_ROOT - Check if re2_ep-install exists before adding re2_ROOT - This handles cases where system dependencies are used instead of bundled Use vcpkg RE2 instead of bundled RE2 for macOS Gandiva build vcpkg installs RE2 as a dependency of LLVM. When we use bundled RE2, the Arrow C++ build compiles Gandiva against vcpkg's RE2 headers (which use std::string_view API) but links against bundled RE2 (which uses StringPiece API), causing linker errors. This change uses vcpkg's RE2 for both compilation and linking when vcpkg LLVM is used, ensuring ABI compatibility. * Add username to tag fix release notes * Fix merge error * Fix quotes * fix env var addressing --- .github/workflows/jarbuild.yml | 21 +++--- ci/scripts/jni_macos_build.sh | 125 +++++++++++++++++++++++++++++---- 2 files changed, 125 insertions(+), 21 deletions(-) mode change 100755 => 100644 ci/scripts/jni_macos_build.sh diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 2d2068d658..3c78dd0639 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -228,12 +228,13 @@ jobs: with: repository: Microsoft/vcpkg path: arrow/vcpkg + fetch-depth: 0 - name: Install vcpkg run: | cd arrow/vcpkg ./bootstrap-vcpkg.sh - echo "VCPKG_ROOT=${PWD}/arrow/vcpkg" >> ${GITHUB_ENV} - echo "${PWD}/arrow/vcpkg" >> ${GITHUB_PATH} + echo "VCPKG_ROOT_LOCAL=${PWD}" >> ${GITHUB_ENV} + echo "${PWD}" >> ${GITHUB_PATH} - name: Clean up disk space run: | echo "=== Free disk space before cleanup ===" @@ -284,25 +285,28 @@ jobs: brew bundle --file=arrow/cpp/Brewfile # Clean up any existing LLVM installations in favor of vcpkg. - brew uninstall llvm || : + # Need to uninstall all versioned LLVM packages (llvm@18, llvm@17, etc.) + for llvm_pkg in $(brew list | grep -E '^llvm(@[0-9]+)?$'); do + brew uninstall "${llvm_pkg}" || : + done # We want to link aws-sdk-cpp statically but Homebrew's # aws-sdk-cpp provides only shared library. If we have # Homebrew's aws-sdk-cpp, our build mix Homebrew's # aws-sdk-cpp and bundled aws-sdk-cpp. We uninstall Homebrew's # aws-sdk-cpp to ensure using only bundled aws-sdk-cpp. - brew uninstall aws-sdk-cpp + brew uninstall aws-sdk-cpp || : # We want to use bundled RE2 for static linking. If # Homebrew's RE2 is installed, its header file may be used. # We uninstall Homebrew's RE2 to ensure using bundled RE2. brew uninstall grpc || : # gRPC depends on RE2 brew uninstall grpc@1.54 || : # gRPC 1.54 may be installed too - brew uninstall re2 + brew uninstall re2 || : # We want to use bundled Protobuf for static linking. If # Homebrew's Protobuf is installed, its library file may be # used on test We uninstall Homebrew's Protobuf to ensure using # bundled Protobuf. - brew uninstall protobuf + brew uninstall protobuf || : echo "" echo "=== Free disk space before LLVM build ===" @@ -312,7 +316,8 @@ jobs: # Use vcpkg to install LLVM. vcpkg install \ --clean-after-build \ - --x-install-root=${VCPKG_ROOT}/installed \ + --vcpkg-root=${VCPKG_ROOT_LOCAL} \ + --x-install-root=${VCPKG_ROOT_LOCAL}/installed \ --x-manifest-root=arrow/ci/vcpkg \ --overlay-ports=arrow/ci/vcpkg/overlay/llvm/ \ --x-feature=gandiva-llvm @@ -558,7 +563,7 @@ jobs: # GH-499: How to create release notes? echo "Creating release: ${{ steps.commit_ids.outputs.release_tag }}" gh release create "${{ steps.commit_ids.outputs.release_tag }}" \ - --notes-from-tag \ + -n "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}
Triggered by: ${{ github.actor }}
Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
arrow_branch: ${{github.event.inputs.ARROW_BRANCH}}
arrow_repo: ${{github.event.inputs.ARROW_REPO}}
release_tag_name: ${{github.event.inputs.RELEASE_TAG_NAME}}
arrow-java branch: ${{github.ref_name}}" \ --prerelease \ --repo ${GITHUB_REPOSITORY} \ --title "Apache Arrow Java ${{ steps.commit_ids.outputs.version }} RC${{ steps.commit_ids.outputs.rc }} (arrow-java: ${{ steps.commit_ids.outputs.arrow_java_commit }}, arrow: ${{ steps.commit_ids.outputs.arrow_commit }})" diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh old mode 100755 new mode 100644 index efc2446752..8db4fa6118 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -69,27 +69,126 @@ export ARROW_PARQUET=ON export AWS_EC2_METADATA_DISABLED=TRUE +# Determine vcpkg triplet based on architecture +vcpkg_arch="$(arch)" +case "${vcpkg_arch}" in +arm64) + vcpkg_triplet="arm64-osx" + ;; +i386|x86_64) + vcpkg_triplet="x64-osx" + ;; +*) + vcpkg_triplet="arm64-osx" + ;; +esac + +# Set LLVM_DIR to point to vcpkg-installed LLVM if VCPKG_ROOT_LOCAL is set +llvm_dir_arg="" +gandiva_cxx_flags="" +osx_sysroot_arg="" +re2_source_arg="-Dre2_SOURCE=BUNDLED" +if [ -n "${VCPKG_ROOT_LOCAL:-}" ]; then + vcpkg_installed="${VCPKG_ROOT_LOCAL}/installed/${vcpkg_triplet}" + llvm_cmake_dir="${vcpkg_installed}/share/llvm" + if [ -d "${llvm_cmake_dir}" ]; then + llvm_dir_arg="-DLLVM_DIR=${llvm_cmake_dir}" + + # vcpkg's clang needs to know where to find system headers + # Arrow's GandivaAddBitcode.cmake uses CMAKE_OSX_SYSROOT to set SDKROOT env var + sdk_path="$(xcrun --show-sdk-path)" + if [ -d "${sdk_path}" ]; then + osx_sysroot_arg="-DCMAKE_OSX_SYSROOT=${sdk_path}" + fi + + # Also pass the C++ standard library include path via ARROW_GANDIVA_PC_CXX_FLAGS + xcode_path="$(xcode-select -p)" + cxx_include_path="${xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1" + if [ -d "${cxx_include_path}" ]; then + gandiva_cxx_flags="-DARROW_GANDIVA_PC_CXX_FLAGS=-stdlib=libc++;-isystem;${cxx_include_path}" + fi + + # Use vcpkg's RE2 since it's installed as a dependency of LLVM + # This ensures ABI compatibility - vcpkg's RE2 uses std::string_view API + # which matches what vcpkg's LLVM and Abseil expect + re2_cmake_dir="${vcpkg_installed}/share/re2" + if [ -d "${re2_cmake_dir}" ]; then + re2_source_arg="-Dre2_ROOT=${vcpkg_installed}" + fi + fi +fi + cmake \ -S "${arrow_dir}/cpp" \ -B "${build_dir}/cpp" \ - --preset=ninja-release-jni-macos \ - -Dabsl_SOURCE=BUNDLED \ - -Dsimdjson_SOURCE=BUNDLED \ - -Duriparser_SOURCE=BUNDLED \ - -DCMAKE_INSTALL_PREFIX="${install_dir}" + -DARROW_ACERO="${ARROW_ACERO}" \ + -DARROW_BUILD_SHARED=OFF \ + -DARROW_BUILD_TESTS="${ARROW_BUILD_TESTS}" \ + -DARROW_CSV="${ARROW_DATASET}" \ + -DARROW_DATASET="${ARROW_DATASET}" \ + -DARROW_SUBSTRAIT="${ARROW_DATASET}" \ + -DARROW_DEPENDENCY_USE_SHARED=OFF \ + -DARROW_GANDIVA="${ARROW_GANDIVA}" \ + -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \ + -DARROW_JSON="${ARROW_DATASET}" \ + -DARROW_ORC="${ARROW_ORC}" \ + -DARROW_PARQUET="${ARROW_PARQUET}" \ + -DARROW_S3="${ARROW_S3}" \ + -DARROW_USE_CCACHE="${ARROW_USE_CCACHE}" \ + -DAWSSDK_SOURCE=BUNDLED \ + -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ + -DCMAKE_INSTALL_PREFIX="${install_dir}" \ + -DCMAKE_UNITY_BUILD="${CMAKE_UNITY_BUILD}" \ + -DGTest_SOURCE=BUNDLED \ + ${llvm_dir_arg} \ + ${osx_sysroot_arg} \ + ${gandiva_cxx_flags} \ + -DPARQUET_BUILD_EXAMPLES=OFF \ + -DPARQUET_BUILD_EXECUTABLES=OFF \ + -DPARQUET_REQUIRE_ENCRYPTION=OFF \ + ${re2_source_arg} \ + -GNinja cmake --build "${build_dir}/cpp" --target install github_actions_group_end -absl_include_dir="${build_dir}/cpp/_deps/absl-src" -if [ ! -d "${absl_include_dir}/absl" ]; then - echo "Bundled Abseil headers were not found in ${absl_include_dir}" >&2 - exit 1 +if [ "${ARROW_RUN_TESTS:-}" == "ON" ]; then + github_actions_group_begin "Running Arrow C++ libraries tests" + # MinIO is required + exclude_tests="arrow-s3fs-test" + # unstable + exclude_tests="${exclude_tests}|arrow-acero-asof-join-node-test" + exclude_tests="${exclude_tests}|arrow-acero-hash-join-node-test" + ctest \ + --exclude-regex "${exclude_tests}" \ + --label-regex unittest \ + --output-on-failure \ + --parallel "$(sysctl -n hw.ncpu)" \ + --test-dir "${build_dir}/cpp" \ + --timeout 300 + github_actions_group_end +fi + +# Pass paths to dependencies so the JNI build can find them +# Build up the JNI CMake args based on what's available +jni_cmake_args="${llvm_dir_arg}" + +# Add Protobuf path if bundled, otherwise CMake will find system Protobuf +if [ -d "${build_dir}/cpp/protobuf_ep-install" ]; then + jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/protobuf_ep-install" +fi + +# RE2 path for the JNI build - prefer vcpkg's RE2 if we used it for the C++ build, +# otherwise fall back to bundled RE2 if available +if [ -n "${VCPKG_ROOT_LOCAL:-}" ]; then + vcpkg_re2_dir="${VCPKG_ROOT_LOCAL}/installed/${vcpkg_triplet}" + if [ -d "${vcpkg_re2_dir}/share/re2" ]; then + jni_cmake_args="${jni_cmake_args} -Dre2_ROOT=${vcpkg_re2_dir}" + fi +elif [ -d "${build_dir}/cpp/re2_ep-install" ]; then + jni_cmake_args="${jni_cmake_args} -Dre2_ROOT=${build_dir}/cpp/re2_ep-install" fi -JAVA_JNI_CMAKE_ARGS="-DProtobuf_ROOT=${build_dir}/cpp/_deps/protobuf-build" -JAVA_JNI_CMAKE_ARGS+=" -DProtobuf_SRC_ROOT_FOLDER=${build_dir}/cpp/_deps/protobuf-src" -JAVA_JNI_CMAKE_ARGS+=" -DARROW_JAVA_JNI_ABSL_INCLUDE_DIR=${absl_include_dir}" -export JAVA_JNI_CMAKE_ARGS +export JAVA_JNI_CMAKE_ARGS="${jni_cmake_args}" "${source_dir}/ci/scripts/jni_build.sh" \ "${source_dir}" \ "${install_dir}" \ From 9a7a607909ad2e0b710199f778201e3a88819853 Mon Sep 17 00:00:00 2001 From: Tim Hurski Date: Wed, 25 Feb 2026 12:54:02 -0500 Subject: [PATCH 36/63] DX-114802: Support Jira tickets in PR titles (#19) * Fix trailing whitespace in UnionListWriter.java * Fix shell script formatting (shfmt) * DX-114802: Support Jira tickets in PR titles * Fix formatting --- .github/workflows/dev_pr.js | 69 +++++++++++++++++++++---------- .pre-commit-config.yaml | 4 +- ci/scripts/jni_macos_build.sh | 10 ++--- ci/scripts/jni_manylinux_build.sh | 26 ++++++------ 4 files changed, 67 insertions(+), 42 deletions(-) diff --git a/.github/workflows/dev_pr.js b/.github/workflows/dev_pr.js index 13acc946e1..05c3a0c8dc 100644 --- a/.github/workflows/dev_pr.js +++ b/.github/workflows/dev_pr.js @@ -122,15 +122,20 @@ module.exports = { const title = context.payload.pull_request.title; if (title.startsWith("MINOR: ")) { console.log("PR is a minor PR"); - return {"issue": null}; + return {"issue": null, "type": "minor"}; } - const match = title.match(/^GH-([0-9]+): .*$/); + const match = title.match(/^(GH|DX)-([0-9]+): .*$/); if (match === null) { - core.setFailed("Invalid PR title format. Must either be MINOR: or GH-NNN:"); - return {"issue": null}; + core.setFailed("Invalid PR title format. Must either be MINOR:, GH-NNN:, or DX-NNN:"); + return {"issue": null, "type": null}; } - return {"issue": parseInt(match[1], 10)}; + + const issueType = match[1]; // "GH" or "DX" + const issueNumber = parseInt(match[2], 10); + + console.log(`PR references ${issueType}-${issueNumber}`); + return {"issue": issueNumber, "type": issueType}; }, apply_labels: async function({core, github, context}) { @@ -203,9 +208,28 @@ See [CONTRIBUTING.md](https://github.com/apache/arrow-java/blob/main/CONTRIBUTIN console.log("This is a MINOR PR"); return; } - const expected = `https://github.com/apache/arrow-java/issues/${issue.issue}`; - const query = ` + // Handle Jira tickets (DX-NNN) + if (issue.type === "DX") { + const jiraUrl = `https://dremio.atlassian.net/browse/DX-${issue.issue}`; + console.log(`This PR references Jira ticket: ${jiraUrl}`); + + // Add a comment with the Jira link + const comment_tag = "jira_link_comment"; + const maybe_comment_id = await have_comment(github, context, context.payload.pull_request.number, comment_tag); + const body_text = ` +**Related Jira Ticket:** [DX-${issue.issue}](${jiraUrl})`; + + await upsert_comment(github, maybe_comment_id, body_text, true); + console.log("Added/updated Jira link comment"); + return; + } + + // Handle GitHub issues (GH-NNN) + if (issue.type === "GH") { + const expected = `https://github.com/apache/arrow-java/issues/${issue.issue}`; + + const query = ` query($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { @@ -220,22 +244,23 @@ query($owner: String!, $name: String!, $number: Int!) { } }`; - const result = await github.graphql(query, { - owner: context.repo.owner, - name: context.repo.repo, - number: context.payload.pull_request.number, - }); - const issues = result.repository.pullRequest.closingIssuesReferences.edges; - console.log(issues); - - for (const link of issues) { - console.log(`PR is linked to ${link.node.number}`); - if (link.node.number === issue.issue) { - console.log(`Found link to ${expected}`); - return; + const result = await github.graphql(query, { + owner: context.repo.owner, + name: context.repo.repo, + number: context.payload.pull_request.number, + }); + const issues = result.repository.pullRequest.closingIssuesReferences.edges; + console.log(issues); + + for (const link of issues) { + console.log(`PR is linked to ${link.node.number}`); + if (link.node.number === issue.issue) { + console.log(`Found link to ${expected}`); + return; + } } + console.log(`Did not find link to ${expected}`); + core.setFailed("Missing link to issue in title"); } - console.log(`Did not find link to ${expected}`); - core.setFailed("Missing link to issue in title"); }, }; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e8faf3cc0..1efb47ed70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,8 +44,8 @@ repos: rm -f apache-arrow-java.tar.gz" always_run: true pass_filenames: false - - repo: https://github.com/koalaman/shellcheck-precommit - rev: v0.10.0 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 hooks: - id: shellcheck args: diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 8db4fa6118..7a16407709 100644 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -75,7 +75,7 @@ case "${vcpkg_arch}" in arm64) vcpkg_triplet="arm64-osx" ;; -i386|x86_64) +i386 | x86_64) vcpkg_triplet="x64-osx" ;; *) @@ -140,13 +140,13 @@ cmake \ -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DCMAKE_UNITY_BUILD="${CMAKE_UNITY_BUILD}" \ -DGTest_SOURCE=BUNDLED \ - ${llvm_dir_arg} \ - ${osx_sysroot_arg} \ - ${gandiva_cxx_flags} \ + "${llvm_dir_arg}" \ + "${osx_sysroot_arg}" \ + "${gandiva_cxx_flags}" \ -DPARQUET_BUILD_EXAMPLES=OFF \ -DPARQUET_BUILD_EXECUTABLES=OFF \ -DPARQUET_REQUIRE_ENCRYPTION=OFF \ - ${re2_source_arg} \ + "${re2_source_arg}" \ -GNinja cmake --build "${build_dir}/cpp" --target install github_actions_group_end diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index 810feb9c3c..d2b948defa 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -26,19 +26,19 @@ set -euo pipefail . "$(dirname "${0}")/util_log.sh" github_actions_group_begin "Update llvm" - vcpkg install \ - --debug \ - --clean-after-build \ - --x-install-root=${VCPKG_ROOT}/installed \ - --x-manifest-root=/arrow/ci/vcpkg \ - --overlay-ports=/arrow/ci/vcpkg/overlay/llvm/ \ - --x-feature=dev \ - --x-feature=flight \ - --x-feature=gcs \ - --x-feature=json \ - --x-feature=parquet \ - --x-feature=gandiva \ - --x-feature=s3 +vcpkg install \ + --debug \ + --clean-after-build \ + --x-install-root="${VCPKG_ROOT}/installed" \ + --x-manifest-root=/arrow/ci/vcpkg \ + --overlay-ports=/arrow/ci/vcpkg/overlay/llvm/ \ + --x-feature=dev \ + --x-feature=flight \ + --x-feature=gcs \ + --x-feature=json \ + --x-feature=parquet \ + --x-feature=gandiva \ + --x-feature=s3 github_actions_group_end github_actions_group_begin "Prepare arguments" From 632aade105df3edcad6bd8a479c5512808d4ea02 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 25 Mar 2026 14:39:57 -0700 Subject: [PATCH 37/63] Fix: build ORC from source to avoid vcpkg interception on macOS --- ci/scripts/jni_macos_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 7a16407709..29a4196c49 100644 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -136,6 +136,7 @@ cmake \ -DARROW_S3="${ARROW_S3}" \ -DARROW_USE_CCACHE="${ARROW_USE_CCACHE}" \ -DAWSSDK_SOURCE=BUNDLED \ + -DORC_SOURCE=BUNDLED \ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DCMAKE_UNITY_BUILD="${CMAKE_UNITY_BUILD}" \ From a3831827af2667c173756f480012ce7178f1841d Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 25 Mar 2026 14:47:02 -0700 Subject: [PATCH 38/63] Fix: build ORC from source to avoid vcpkg interception on linux --- ci/scripts/jni_manylinux_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index d2b948defa..894132f3e3 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -90,6 +90,7 @@ cmake \ -S "${arrow_dir}/cpp" \ -B "${build_dir}/cpp" \ --preset=ninja-release-jni-linux \ + -DORC_SOURCE=BUNDLED \ -DCMAKE_INSTALL_PREFIX="${install_dir}" cmake --build "${build_dir}/cpp" cmake --install "${build_dir}/cpp" From 1e3991e9036d4040b5ff766acc55610d78afa8e4 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 25 Mar 2026 16:08:47 -0700 Subject: [PATCH 39/63] Fix: restore execute permission on jni_macos_build.sh --- ci/scripts/jni_macos_build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci/scripts/jni_macos_build.sh diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh old mode 100644 new mode 100755 From 5bf0649211ae2820d10f35a1ce5ff783417dcdb9 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Wed, 25 Mar 2026 16:14:21 -0700 Subject: [PATCH 40/63] Fix executable permission issue --- ci/scripts/jni_macos_build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 ci/scripts/jni_macos_build.sh diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh old mode 100755 new mode 100644 From b3f68c26931f0f69c462f1050afbc11dfddca5be Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 26 Mar 2026 11:31:33 -0700 Subject: [PATCH 41/63] fix executable --- ci/scripts/jni_macos_build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci/scripts/jni_macos_build.sh diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh old mode 100644 new mode 100755 From a990298a077c3a8c349f5ab53834794986b0de8f Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 26 Mar 2026 13:45:25 -0700 Subject: [PATCH 42/63] Fix: set default values for ARROW_ACERO and ARROW_S3 in jni_macos_build.sh --- ci/scripts/jni_macos_build.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 29a4196c49..520d89405d 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -62,10 +62,14 @@ install_dir="${build_dir}/cpp-install" export ARROW_BUILD_TESTS=OFF +: "${ARROW_ACERO:=ON}" +export ARROW_ACERO export ARROW_DATASET=ON export ARROW_GANDIVA=ON export ARROW_ORC=ON export ARROW_PARQUET=ON +: "${ARROW_S3:=ON}" +export ARROW_S3 export AWS_EC2_METADATA_DISABLED=TRUE From defe1213024fbd0d3363b0b50a46c354d8979a6a Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 27 Mar 2026 10:18:42 -0700 Subject: [PATCH 43/63] Fix: set default values for CMAKE_BUILD_TYPE and CMAKE_UNITY_BUILD in jni_macos_build.sh --- ci/scripts/jni_macos_build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 520d89405d..c997d224a1 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -51,6 +51,8 @@ build_dir="$(cd "${build_dir}" && pwd)" github_actions_group_end : "${ARROW_USE_CCACHE:=ON}" +: "${CMAKE_BUILD_TYPE:=release}" +: "${CMAKE_UNITY_BUILD:=ON}" if [ "${ARROW_USE_CCACHE}" == "ON" ]; then github_actions_group_begin "ccache statistics before build" ccache -sv 2>/dev/null || ccache -s From af9710288954eb32a26acf903a9cca1eb602831e Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 27 Mar 2026 10:26:01 -0700 Subject: [PATCH 44/63] keep unity build off --- ci/scripts/jni_macos_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index c997d224a1..ca96a2d16b 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -52,7 +52,7 @@ github_actions_group_end : "${ARROW_USE_CCACHE:=ON}" : "${CMAKE_BUILD_TYPE:=release}" -: "${CMAKE_UNITY_BUILD:=ON}" +: "${CMAKE_UNITY_BUILD:=OFF}" if [ "${ARROW_USE_CCACHE}" == "ON" ]; then github_actions_group_begin "ccache statistics before build" ccache -sv 2>/dev/null || ccache -s From b172c033c5ae1deb2520c020754227d0107cf684 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 27 Mar 2026 11:43:50 -0700 Subject: [PATCH 45/63] Fix: look for protobuf_fc-install (FetchContent) in addition to protobuf_ep-install --- ci/scripts/jni_macos_build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index ca96a2d16b..ddde6eca0d 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -179,8 +179,11 @@ fi # Build up the JNI CMake args based on what's available jni_cmake_args="${llvm_dir_arg}" -# Add Protobuf path if bundled, otherwise CMake will find system Protobuf -if [ -d "${build_dir}/cpp/protobuf_ep-install" ]; then +# Add Protobuf path if bundled, otherwise CMake will find system Protobuf. +# Arrow 23+ uses FetchContent (protobuf_fc-install); older versions used ExternalProject (protobuf_ep-install). +if [ -d "${build_dir}/cpp/protobuf_fc-install" ]; then + jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/protobuf_fc-install" +elif [ -d "${build_dir}/cpp/protobuf_ep-install" ]; then jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/protobuf_ep-install" fi From 12faa2479fd6376134a83d9c4561666ecd8eca6c Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 27 Mar 2026 14:09:39 -0700 Subject: [PATCH 46/63] Fix: explicitly build protobuf_fc target to populate protobuf_fc-install for JNI build --- ci/scripts/jni_macos_build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index ddde6eca0d..89846c2cb7 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -156,6 +156,11 @@ cmake \ "${re2_source_arg}" \ -GNinja cmake --build "${build_dir}/cpp" --target install +# Arrow 23+ builds Protobuf via FetchContent. The protobuf_fc target installs it +# to protobuf_fc-install so the separate JNI CMake invocation can find it. +# This target is NOT in the install dependency chain (Ninja skips ALL-only targets +# when building --target install), so we must trigger it explicitly. +cmake --build "${build_dir}/cpp" --target protobuf_fc || true github_actions_group_end if [ "${ARROW_RUN_TESTS:-}" == "ON" ]; then From cb088d781662cc6e1a5d8b0280fecf9667f01366 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 27 Mar 2026 18:11:54 -0700 Subject: [PATCH 47/63] Update release tag name --- .github/workflows/jarbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 3c78dd0639..181f8b738a 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -563,7 +563,7 @@ jobs: # GH-499: How to create release notes? echo "Creating release: ${{ steps.commit_ids.outputs.release_tag }}" gh release create "${{ steps.commit_ids.outputs.release_tag }}" \ - -n "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}
Triggered by: ${{ github.actor }}
Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
arrow_branch: ${{github.event.inputs.ARROW_BRANCH}}
arrow_repo: ${{github.event.inputs.ARROW_REPO}}
release_tag_name: ${{github.event.inputs.RELEASE_TAG_NAME}}
arrow-java branch: ${{github.ref_name}}" \ + -n "Release ${{ steps.commit_ids.outputs.release_name }} RC${{ steps.commit_ids.outputs.rc }}
Triggered by: ${{ github.actor }}
Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
arrow_branch: ${{github.event.inputs.ARROW_BRANCH}}
arrow_repo: ${{github.event.inputs.ARROW_REPO}}
arrow-java branch: ${{github.ref_name}}
release_tag_name: ${{ steps.commit_ids.outputs.release_tag }}" \ --prerelease \ --repo ${GITHUB_REPOSITORY} \ --title "Apache Arrow Java ${{ steps.commit_ids.outputs.version }} RC${{ steps.commit_ids.outputs.rc }} (arrow-java: ${{ steps.commit_ids.outputs.arrow_java_commit }}, arrow: ${{ steps.commit_ids.outputs.arrow_commit }})" From c22ffcdc2947230c34819e7e77bbe389ee7022dc Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Fri, 16 May 2025 11:59:47 -0700 Subject: [PATCH 48/63] Revert "MINOR: Bump com.google.protobuf:protobuf-bom from 3.25.5 to 4.30.0 (#666)" This reverts commit d13f0e08972da3311442bdf23f75d27f4998fc85. --- .../java/org/apache/arrow/flight/auth/ClientAuthWrapper.java | 4 +++- .../java/org/apache/arrow/flight/auth/ServerAuthWrapper.java | 4 +++- flight/flight-integration-tests/src/shade/LICENSE.txt | 4 ++-- flight/flight-sql-jdbc-driver/src/shade/LICENSE.txt | 4 ++-- pom.xml | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthWrapper.java b/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthWrapper.java index 19d4f77a03..dd62f7756e 100644 --- a/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthWrapper.java +++ b/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthWrapper.java @@ -76,7 +76,9 @@ public AuthObserver() { @Override public void onNext(HandshakeResponse value) { ByteString payload = value.getPayload(); - messages.add(payload.toByteArray()); + if (payload != null) { + messages.add(payload.toByteArray()); + } } private Iterator iter = diff --git a/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthWrapper.java b/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthWrapper.java index fba9f9baba..879a93a73b 100644 --- a/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthWrapper.java +++ b/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthWrapper.java @@ -84,7 +84,9 @@ public AuthObserver(StreamObserver responseObserver) { @Override public void onNext(HandshakeRequest value) { ByteString payload = value.getPayload(); - messages.add(payload.toByteArray()); + if (payload != null) { + messages.add(payload.toByteArray()); + } } private Iterator iter = diff --git a/flight/flight-integration-tests/src/shade/LICENSE.txt b/flight/flight-integration-tests/src/shade/LICENSE.txt index 3367c36f79..96012a838c 100644 --- a/flight/flight-integration-tests/src/shade/LICENSE.txt +++ b/flight/flight-integration-tests/src/shade/LICENSE.txt @@ -272,11 +272,11 @@ License: https://www.apache.org/licenses/LICENSE-2.0 -------------------------------------------------------------------------------- -This binary artifact contains Google Protobuf 4.30.2. +This binary artifact contains Google Protobuf 3.25.5. Copyright: Copyright 2008 Google Inc. All rights reserved. Home page: https://protobuf.dev/ -License: https://github.com/protocolbuffers/protobuf/blob/v4.30.1/LICENSE (BSD) +License: https://github.com/protocolbuffers/protobuf/blob/v3.25.5/LICENSE (BSD) License text: | Copyright 2008 Google Inc. All rights reserved. diff --git a/flight/flight-sql-jdbc-driver/src/shade/LICENSE.txt b/flight/flight-sql-jdbc-driver/src/shade/LICENSE.txt index 942192b5d8..67eb1d9da4 100644 --- a/flight/flight-sql-jdbc-driver/src/shade/LICENSE.txt +++ b/flight/flight-sql-jdbc-driver/src/shade/LICENSE.txt @@ -234,11 +234,11 @@ License: https://www.apache.org/licenses/LICENSE-2.0 -------------------------------------------------------------------------------- -This binary artifact contains Protobuf 4.30.2. +This binary artifact contains Protobuf 3.25.5. Copyright: Copyright 2008 Google Inc. All rights reserved. Home page: https://protobuf.dev/ -License: https://github.com/protocolbuffers/protobuf/blob/v4.30.1/LICENSE (BSD) +License: https://github.com/protocolbuffers/protobuf/blob/v3.25.3/LICENSE (BSD) License text: | Copyright 2008 Google Inc. All rights reserved. diff --git a/pom.xml b/pom.xml index 53f12b4f56..3050286744 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ under the License. 33.7.1-jre 4.2.17.Final 1.84.0 - 4.35.1 + 3.25.5 2.22.0 3.5.0 25.2.10 From a9063aeeb2f9099b9d64170fd0aaa225b114d84d Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 30 Mar 2026 13:48:05 -0700 Subject: [PATCH 49/63] Fix: downgrade proto-google-common-protos to 2.64.1 for protobuf 3.25.5 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2.65.0+ was compiled against protobuf 4.33.2 and references RuntimeVersion$RuntimeDomain, which does not exist in protobuf 3.25.5. 2.64.1 is the last version compiled against protobuf 3.25.x, making it compatible with the pinned dep.protobuf-bom.version=3.25.5. grpc-protobuf 1.79.0 itself only requires proto-google-common-protos 2.63.2, so staying on grpc-bom 1.79.0 is fine — only the explicit 2.66.0 override in flight-core/pom.xml needed to be reverted. --- flight/flight-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/flight-core/pom.xml b/flight/flight-core/pom.xml index 905db61af7..f8dec29dd2 100644 --- a/flight/flight-core/pom.xml +++ b/flight/flight-core/pom.xml @@ -133,7 +133,7 @@ under the License. com.google.api.grpc proto-google-common-protos - 2.74.0 + 2.64.1 test From 99952134f580183f837dce3663a3bddfbd2926f7 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 16 Apr 2026 08:38:27 -0700 Subject: [PATCH 50/63] Fix Build error on ubuntu (#24) (#25) --- ci/scripts/jni_manylinux_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index 894132f3e3..c750031f35 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -50,7 +50,7 @@ dist_dir="${4}" github_actions_group_end github_actions_group_begin "Install Archery" -pip install -e "${arrow_dir}/dev/archery[all]" +pip install -e "${arrow_dir}/dev/archery" github_actions_group_end github_actions_group_begin "Clear output directories and leftovers" From 8a838c0bb0833b427b0eaa93ae2ad02177ab88a8 Mon Sep 17 00:00:00 2001 From: Prashanth Badari <102688956+prashanthbdremio@users.noreply.github.com> Date: Tue, 7 Jul 2026 11:41:41 -0400 Subject: [PATCH 51/63] MINOR: Preserve empty list offset buffer (#30) Preserve the Arrow-required empty list offset buffer entry while avoiding malformed Netty buffer state. ListVector and LargeListVector now materialize a one-entry offset buffer when an empty vector still needs to expose offset[0], then set the writer index from (valueCount + 1) * OFFSET_WIDTH. --- .../arrow/vector/complex/LargeListVector.java | 53 +++++++---- .../arrow/vector/complex/ListVector.java | 19 ++++ .../arrow/vector/TestLargeListVector.java | 87 ++++++++++++++++++- .../apache/arrow/vector/TestListVector.java | 87 ++++++++++++++++++- .../arrow/vector/TestSplitAndTransfer.java | 44 ++++++++-- 5 files changed, 267 insertions(+), 23 deletions(-) diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java index 9368b5ce3c..66d629cf1f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java @@ -305,10 +305,12 @@ public void exportCDataBuffers(List buffers, ArrowBuf buffersPtr, long /** Set the reader and writer indexes for the inner buffers. */ private void setReaderAndWriterIndex() { + final long requiredOffsetBufferCapacity = (long) (valueCount + 1) * OFFSET_WIDTH; validityBuffer.readerIndex(0); offsetBuffer.readerIndex(0); if (valueCount == 0) { validityBuffer.writerIndex(0); + ensureEmptyOffsetBufferCapacity(requiredOffsetBufferCapacity); } else { validityBuffer.writerIndex(BitVectorHelper.getValidityBufferSizeFromCount(valueCount)); } @@ -319,6 +321,19 @@ private void setReaderAndWriterIndex() { offsetBuffer.writerIndex((long) (valueCount + 1) * OFFSET_WIDTH); } + private void ensureEmptyOffsetBufferCapacity(long requiredCapacity) { + if (offsetBuffer.capacity() >= requiredCapacity) { + return; + } + long previousOffsetAllocationSizeInBytes = offsetAllocationSizeInBytes; + ArrowBuf oldOffsetBuffer = offsetBuffer; + offsetBuffer = allocateOffsetBuffer(requiredCapacity); + offsetBuffer.setBytes( + 0, oldOffsetBuffer, 0, Math.min(oldOffsetBuffer.capacity(), requiredCapacity)); + offsetAllocationSizeInBytes = previousOffsetAllocationSizeInBytes; + oldOffsetBuffer.getReferenceManager().release(); + } + /** * Get the inner vectors. * @@ -674,24 +689,30 @@ public void splitAndTransfer(int startIndex, int length) { startIndex, length, valueCount); - final long startPoint = offsetBuffer.getLong((long) startIndex * OFFSET_WIDTH); - final long sliceLength = - offsetBuffer.getLong((long) (startIndex + length) * OFFSET_WIDTH) - startPoint; to.clear(); - to.offsetBuffer = to.allocateOffsetBuffer((length + 1) * OFFSET_WIDTH); - /* splitAndTransfer offset buffer */ - for (int i = 0; i < length + 1; i++) { - final long relativeOffset = - offsetBuffer.getLong((long) (startIndex + i) * OFFSET_WIDTH) - startPoint; - to.offsetBuffer.setLong((long) i * OFFSET_WIDTH, relativeOffset); + if (length > 0) { + final long startPoint = offsetBuffer.getLong((long) startIndex * OFFSET_WIDTH); + final long sliceLength = + offsetBuffer.getLong((long) (startIndex + length) * OFFSET_WIDTH) - startPoint; + to.offsetBuffer = to.allocateOffsetBuffer((length + 1) * OFFSET_WIDTH); + /* splitAndTransfer offset buffer */ + for (int i = 0; i < length + 1; i++) { + final long relativeOffset = + offsetBuffer.getLong((long) (startIndex + i) * OFFSET_WIDTH) - startPoint; + to.offsetBuffer.setLong((long) i * OFFSET_WIDTH, relativeOffset); + } + /* splitAndTransfer validity buffer */ + splitAndTransferValidityBuffer(startIndex, length, to); + /* splitAndTransfer data buffer */ + dataTransferPair.splitAndTransfer( + checkedCastToInt(startPoint), checkedCastToInt(sliceLength)); + to.lastSet = length - 1; + to.setValueCount(length); + } else { + to.ensureEmptyOffsetBufferCapacity(OFFSET_WIDTH); + dataTransferPair.splitAndTransfer(0, 0); + to.setValueCount(0); } - /* splitAndTransfer validity buffer */ - splitAndTransferValidityBuffer(startIndex, length, to); - /* splitAndTransfer data buffer */ - dataTransferPair.splitAndTransfer( - checkedCastToInt(startPoint), checkedCastToInt(sliceLength)); - to.lastSet = length - 1; - to.setValueCount(length); } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java index 6c3993df63..2802cd7577 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java @@ -263,10 +263,12 @@ public void exportCDataBuffers(List buffers, ArrowBuf buffersPtr, long /** Set the reader and writer indexes for the inner buffers. */ private void setReaderAndWriterIndex() { + final long requiredOffsetBufferCapacity = (long) (valueCount + 1) * OFFSET_WIDTH; validityBuffer.readerIndex(0); offsetBuffer.readerIndex(0); if (valueCount == 0) { validityBuffer.writerIndex(0); + ensureEmptyOffsetBufferCapacity(requiredOffsetBufferCapacity); } else { validityBuffer.writerIndex(BitVectorHelper.getValidityBufferSizeFromCount(valueCount)); } @@ -277,6 +279,19 @@ private void setReaderAndWriterIndex() { offsetBuffer.writerIndex((long) (valueCount + 1) * OFFSET_WIDTH); } + private void ensureEmptyOffsetBufferCapacity(long requiredCapacity) { + if (offsetBuffer.capacity() >= requiredCapacity) { + return; + } + long previousOffsetAllocationSizeInBytes = offsetAllocationSizeInBytes; + ArrowBuf oldOffsetBuffer = offsetBuffer; + offsetBuffer = allocateOffsetBuffer(requiredCapacity); + offsetBuffer.setBytes( + 0, oldOffsetBuffer, 0, Math.min(oldOffsetBuffer.capacity(), requiredCapacity)); + offsetAllocationSizeInBytes = previousOffsetAllocationSizeInBytes; + oldOffsetBuffer.getReferenceManager().release(); + } + /** * Get the inner vectors. * @@ -572,6 +587,10 @@ public void splitAndTransfer(int startIndex, int length) { dataTransferPair.splitAndTransfer(startPoint, sliceLength); to.lastSet = length - 1; to.setValueCount(length); + } else { + to.ensureEmptyOffsetBufferCapacity(OFFSET_WIDTH); + dataTransferPair.splitAndTransfer(0, 0); + to.setValueCount(0); } } diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index b6823fbf3c..54f5f198a6 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -966,6 +966,91 @@ public void testGetBufferSizeFor() { } } + @Test + public void testEmptyLargeListOffsetBuffer() { + try (LargeListVector list = LargeListVector.empty("list", allocator)) { + list.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + list.allocateNew(); + list.setValueCount(0); + + assertEmptyLargeListOffsetBuffer(list); + } + } + + @Test + public void testUnallocatedEmptyLargeListOffsetBuffer() { + try (LargeListVector list = LargeListVector.empty("list", allocator)) { + list.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + list.setValueCount(0); + + assertEmptyLargeListOffsetBuffer(list); + } + } + + @Test + public void testSplitAndTransferEmptyLargeListOffsetBuffer() { + try (LargeListVector source = LargeListVector.empty("source", allocator); + LargeListVector target = LargeListVector.empty("target", allocator)) { + source.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + target.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + source.allocateNew(); + source.setValueCount(0); + + TransferPair transferPair = source.makeTransferPair(target); + transferPair.splitAndTransfer(0, 0); + + assertEmptyLargeListOffsetBuffer(target); + } + } + + @Test + public void testSplitAndTransferEmptyLargeListAllocatesOffsetBuffer() { + try (LargeListVector fromVector = LargeListVector.empty("fromVector", allocator); + LargeListVector toVector = LargeListVector.empty("toVector", allocator)) { + fromVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + fromVector.allocateNew(); + fromVector.setValueCount(0); + + TransferPair transferPair = fromVector.makeTransferPair(toVector); + transferPair.splitAndTransfer(0, 0); + + assertAllocatedEmptyLargeListOffsetBuffer(toVector); + } + } + + @Test + public void testSplitAndTransferEmptyNestedLargeListAllocatesOffsetBuffers() { + try (LargeListVector fromVector = LargeListVector.empty("fromVector", allocator); + LargeListVector toVector = LargeListVector.empty("toVector", allocator)) { + fromVector.addOrGetVector(FieldType.nullable(MinorType.LARGELIST.getType())); + LargeListVector childVector = (LargeListVector) fromVector.getDataVector(); + childVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + fromVector.allocateNew(); + fromVector.setValueCount(0); + + TransferPair transferPair = fromVector.makeTransferPair(toVector); + transferPair.splitAndTransfer(0, 0); + + assertAllocatedEmptyLargeListOffsetBuffer(toVector); + assertAllocatedEmptyLargeListOffsetBuffer((LargeListVector) toVector.getDataVector()); + } + } + + private ArrowBuf assertEmptyLargeListOffsetBuffer(LargeListVector list) { + List buffers = list.getFieldBuffers(); + ArrowBuf offsetBuffer = buffers.get(1); + assertEquals(LargeListVector.OFFSET_WIDTH, offsetBuffer.readableBytes()); + assertTrue(offsetBuffer.capacity() >= LargeListVector.OFFSET_WIDTH); + assertEquals(0L, offsetBuffer.getLong(0)); + return offsetBuffer; + } + + private void assertAllocatedEmptyLargeListOffsetBuffer(LargeListVector list) { + ArrowBuf offsetBuffer = list.getOffsetBuffer(); + assertTrue(offsetBuffer.capacity() >= LargeListVector.OFFSET_WIDTH); + assertEquals(0L, offsetBuffer.getLong(0)); + } + @Test public void testIsEmpty() { try (final LargeListVector vector = LargeListVector.empty("list", allocator)) { @@ -1105,7 +1190,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { } @Test - public void testEmptyLargeListOffsetBuffer() { + public void testEmptyLargeListOffsetBufferSize() { // Test that LargeListVector has correct readableBytes after allocation. // According to Arrow spec, offset buffer must have N+1 entries. // Even when N=0, it should contain [0]. diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index 0c90b32abc..60b675a1b5 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -1142,6 +1142,91 @@ public void testGetBufferSizeFor() { } } + @Test + public void testEmptyListOffsetBuffer() { + try (ListVector list = ListVector.empty("list", allocator)) { + list.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + list.allocateNew(); + list.setValueCount(0); + + assertEmptyListOffsetBuffer(list); + } + } + + @Test + public void testUnallocatedEmptyListOffsetBuffer() { + try (ListVector list = ListVector.empty("list", allocator)) { + list.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + list.setValueCount(0); + + assertEmptyListOffsetBuffer(list); + } + } + + @Test + public void testSplitAndTransferEmptyListOffsetBuffer() { + try (ListVector source = ListVector.empty("source", allocator); + ListVector target = ListVector.empty("target", allocator)) { + source.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + target.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + source.allocateNew(); + source.setValueCount(0); + + TransferPair transferPair = source.makeTransferPair(target); + transferPair.splitAndTransfer(0, 0); + + assertEmptyListOffsetBuffer(target); + } + } + + @Test + public void testSplitAndTransferEmptyListAllocatesOffsetBuffer() { + try (ListVector fromVector = ListVector.empty("fromVector", allocator); + ListVector toVector = ListVector.empty("toVector", allocator)) { + fromVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + fromVector.allocateNew(); + fromVector.setValueCount(0); + + TransferPair transferPair = fromVector.makeTransferPair(toVector); + transferPair.splitAndTransfer(0, 0); + + assertAllocatedEmptyListOffsetBuffer(toVector); + } + } + + @Test + public void testSplitAndTransferEmptyNestedListAllocatesOffsetBuffers() { + try (ListVector fromVector = ListVector.empty("fromVector", allocator); + ListVector toVector = ListVector.empty("toVector", allocator)) { + fromVector.addOrGetVector(FieldType.nullable(MinorType.LIST.getType())); + ListVector childVector = (ListVector) fromVector.getDataVector(); + childVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType())); + fromVector.allocateNew(); + fromVector.setValueCount(0); + + TransferPair transferPair = fromVector.makeTransferPair(toVector); + transferPair.splitAndTransfer(0, 0); + + assertAllocatedEmptyListOffsetBuffer(toVector); + assertAllocatedEmptyListOffsetBuffer((ListVector) toVector.getDataVector()); + } + } + + private ArrowBuf assertEmptyListOffsetBuffer(ListVector list) { + List buffers = list.getFieldBuffers(); + ArrowBuf offsetBuffer = buffers.get(1); + assertEquals(BaseRepeatedValueVector.OFFSET_WIDTH, offsetBuffer.readableBytes()); + assertTrue(offsetBuffer.capacity() >= BaseRepeatedValueVector.OFFSET_WIDTH); + assertEquals(0, offsetBuffer.getInt(0)); + return offsetBuffer; + } + + private void assertAllocatedEmptyListOffsetBuffer(ListVector list) { + ArrowBuf offsetBuffer = list.getOffsetBuffer(); + assertTrue(offsetBuffer.capacity() >= BaseRepeatedValueVector.OFFSET_WIDTH); + assertEquals(0, offsetBuffer.getInt(0)); + } + @Test public void testIsEmpty() { try (final ListVector vector = ListVector.empty("list", allocator)) { @@ -1380,7 +1465,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { } @Test - public void testEmptyListOffsetBuffer() { + public void testEmptyListOffsetBufferSize() { // Test that ListVector has correct readableBytes after allocation. // According to Arrow spec, offset buffer must have N+1 entries. // Even when N=0, it should contain [0]. diff --git a/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java b/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java index adf4eba10c..a51c3e74fa 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java @@ -28,10 +28,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.RootAllocator; +import org.apache.arrow.vector.complex.BaseRepeatedValueVector; import org.apache.arrow.vector.complex.DenseUnionVector; import org.apache.arrow.vector.complex.FixedSizeListVector; +import org.apache.arrow.vector.complex.LargeListVector; import org.apache.arrow.vector.complex.LargeListViewVector; import org.apache.arrow.vector.complex.ListVector; import org.apache.arrow.vector.complex.MapVector; @@ -111,13 +114,16 @@ private void populateDenseUnionVector(final DenseUnionVector vector, int valueCo @Test public void testWithEmptyVector() { // MapVector use TransferImpl from ListVector - ListVector listVector = ListVector.empty("", allocator); - TransferPair transferPair = listVector.getTransferPair(allocator); - transferPair.splitAndTransfer(0, 0); - assertEquals(0, transferPair.getTo().getValueCount()); + try (ListVector listVector = ListVector.empty("", allocator)) { + TransferPair transferPair = listVector.getTransferPair(allocator); + try (ValueVector toVector = transferPair.getTo()) { + transferPair.splitAndTransfer(0, 0); + assertEquals(0, toVector.getValueCount()); + } + } // BaseFixedWidthVector IntVector intVector = new IntVector("", allocator); - transferPair = intVector.getTransferPair(allocator); + TransferPair transferPair = intVector.getTransferPair(allocator); transferPair.splitAndTransfer(0, 0); assertEquals(0, transferPair.getTo().getValueCount()); // BaseVariableWidthVector @@ -911,6 +917,11 @@ public void testListVectorZeroStartIndexAndLength() { tp.splitAndTransfer(0, 0); assertEquals(valueCount, newListVector.getValueCount()); + List buffers = newListVector.getFieldBuffers(); + ArrowBuf offsetBuffer = buffers.get(1); + assertEquals(BaseRepeatedValueVector.OFFSET_WIDTH, offsetBuffer.readableBytes()); + assertTrue(offsetBuffer.capacity() >= BaseRepeatedValueVector.OFFSET_WIDTH); + assertEquals(0, offsetBuffer.getInt(0)); newListVector.clear(); } @@ -935,6 +946,29 @@ public void testLargeListViewVectorZeroStartIndexAndLength() { } } + @Test + public void testLargeListVectorZeroStartIndexAndLength() { + try (final LargeListVector listVector = LargeListVector.empty("largelist", allocator); + final LargeListVector newListVector = LargeListVector.empty("newList", allocator)) { + + listVector.allocateNew(); + final int valueCount = 0; + listVector.setValueCount(valueCount); + + final TransferPair tp = listVector.makeTransferPair(newListVector); + + tp.splitAndTransfer(0, 0); + assertEquals(valueCount, newListVector.getValueCount()); + List buffers = newListVector.getFieldBuffers(); + ArrowBuf offsetBuffer = buffers.get(1); + assertEquals(LargeListVector.OFFSET_WIDTH, offsetBuffer.readableBytes()); + assertTrue(offsetBuffer.capacity() >= LargeListVector.OFFSET_WIDTH); + assertEquals(0L, offsetBuffer.getLong(0)); + + newListVector.clear(); + } + } + @Test public void testStructVectorZeroStartIndexAndLength() { Map metadata = new HashMap<>(); From e42f61da1570e4a3e3da53f107fcc63e06d02044 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 8 Oct 2026 15:36:59 -0700 Subject: [PATCH 52/63] DX-125697: Gandiva expression-compilation lock contention limits single-large-node parallelism (#33) * GH-601: Stripe Projector/Filter make() locking by cache key instead of a blanket process-wide lock Projector.make() and Filter.make() are declared `static synchronized`, so every LLVM module build in a process serializes behind one class-level monitor -- regardless of whether the concurrent calls target the same expression or completely unrelated ones. On a single JVM packed with many threads (e.g. a large single-node executor), this collapses what should be independent compilations onto one lock, which JFR shows as the dominant source of monitor contention under concurrent query load. The blanket lock was added in GH-601/#602 to guard against a genuine TOCTOU race in Gandiva's native object cache: two threads compiling the identical (schema, expressions, selection vector mode, configuration) tuple concurrently can both decide the entry is missing and independently define the same generated LLVM symbol, causing LLVM ORC's duplicate-symbol detection to fire. The real fix for that race belongs in the native Gandiva cache-read path (a separate, non-arrow-java change); until it lands, some form of serialization is still required for genuinely identical concurrent builds. Replace the class-level lock with a small striped lock keyed by a hash of the same tuple that identifies a native cache entry (schema bytes, expression/condition bytes, selection vector mode, configuration id). Concurrent make() calls that hash to the same stripe still serialize -- preserving the invariant that avoids the duplicate-symbol crash -- while unrelated concurrent compilations, which make up the large majority of concurrent traffic, proceed in parallel instead of queuing behind one process-wide lock. Verified against ProjectorTest#testMakeProjectorParallel (the existing GH-601 concurrency repro) and the full Projector/Filter test suite with the real Gandiva JNI library, no regressions. Co-Authored-By: Claude Sonnet 5 * Remove lock stripe * remove * spotless * add benchmark for synchronization changes * fix error * fix error --------- Co-authored-by: Chris Pride Co-authored-by: Claude Sonnet 5 --- .github/workflows/jarbuild.yml | 7 + .../arrow/gandiva/evaluator/Filter.java | 10 +- .../arrow/gandiva/evaluator/Projector.java | 16 +- .../evaluator/MakeConcurrencyBenchmark.java | 277 ++++++++++++++++++ .../gandiva/evaluator/ProjectorTest.java | 201 +++++++++++-- 5 files changed, 476 insertions(+), 35 deletions(-) create mode 100644 gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/MakeConcurrencyBenchmark.java diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 181f8b738a..28a9377944 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -267,6 +267,13 @@ jobs: # tries to replace /usr/local/bin/2to3 and so on and causes # a conflict error. brew update + # The runner image has stale symlinks (e.g. bin/openssl) pointing + # at the keg-only openssl@1.1. "brew unlink openssl@1.1" doesn't + # remove them, and they block openssl@3 from linking when it's + # upgraded as a python@XXX dependency. Remove them directly. + brew_prefix="$(brew --prefix)" + find "${brew_prefix}/bin" "${brew_prefix}/lib" "${brew_prefix}/include" \ + -maxdepth 2 -type l -lname '*openssl@1.1*' -print -delete 2>/dev/null || : for python_package in $(brew list | grep python@); do brew install --overwrite ${python_package} done diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java index 6c8540cde8..06577a516e 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Filter.java @@ -111,14 +111,18 @@ public static Filter make(Schema schema, Condition condition, boolean optimize) * @param configurationId Custom configuration created through config builder. * @return A native evaluator object that can be used to invoke these projections on a RecordBatch */ - public static synchronized Filter make(Schema schema, Condition condition, long configurationId) + public static Filter make(Schema schema, Condition condition, long configurationId) throws GandivaException { // Invoke the JNI layer to create the LLVM module representing the filter. GandivaTypes.Condition conditionBuf = condition.toProtobuf(); GandivaTypes.Schema schemaBuf = ArrowTypeHelper.arrowSchemaToProtobuf(schema); + byte[] schemaBytes = schemaBuf.toByteArray(); + byte[] conditionBytes = conditionBuf.toByteArray(); JniWrapper wrapper = JniLoader.getInstance().getWrapper(); - long moduleId = - wrapper.buildFilter(schemaBuf.toByteArray(), conditionBuf.toByteArray(), configurationId); + // No lock here, deliberately -- see the equivalent comment in Projector.make(). The + // duplicate-LLVM-symbol race from GH-601 is fixed in Gandiva's native Filter::Make(), so this + // no longer needs to be serialized. + long moduleId = wrapper.buildFilter(schemaBytes, conditionBytes, configurationId); logger.debug("Created module for the filter with id {}", moduleId); return new Filter(wrapper, moduleId, schema); } diff --git a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java index 9c5b22d659..13fc040f34 100644 --- a/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java +++ b/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java @@ -188,7 +188,7 @@ public static Projector make( * @param configurationId Custom configuration created through config builder. * @return A native evaluator object that can be used to invoke these projections on a RecordBatch */ - public static synchronized Projector make( + public static Projector make( Schema schema, List exprs, SelectionVectorType selectionVectorType, @@ -202,13 +202,19 @@ public static synchronized Projector make( // Invoke the JNI layer to create the LLVM module representing the expressions GandivaTypes.Schema schemaBuf = ArrowTypeHelper.arrowSchemaToProtobuf(schema); + byte[] schemaBytes = schemaBuf.toByteArray(); + byte[] exprBytes = builder.build().toByteArray(); JniWrapper wrapper = JniLoader.getInstance().getWrapper(); + // No lock here, deliberately. This method used to be `static synchronized`, which serialized + // every LLVM compilation in the process, because concurrent builds for the same native + // expression-cache key could race and fail with a duplicate-LLVM-symbol error (GH-601). + // That race was a double read of the native object cache inside Projector::Make(), and it is + // fixed in Gandiva itself -- see "GH-601: Fix TOCTOU race in Gandiva's LLVM object cache read" + // in the arrow C++ tree. Concurrent buildProjector() calls are safe against a Gandiva that + // contains that fix; do not re-add a lock here without first checking the native side. long moduleId = wrapper.buildProjector( - schemaBuf.toByteArray(), - builder.build().toByteArray(), - selectionVectorType.getNumber(), - configurationId); + schemaBytes, exprBytes, selectionVectorType.getNumber(), configurationId); logger.debug("Created module for the projector with id {}", moduleId); return new Projector(wrapper, moduleId, schema, exprs.size()); } diff --git a/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/MakeConcurrencyBenchmark.java b/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/MakeConcurrencyBenchmark.java new file mode 100644 index 0000000000..397e850894 --- /dev/null +++ b/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/MakeConcurrencyBenchmark.java @@ -0,0 +1,277 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.arrow.gandiva.evaluator; + +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; +import org.apache.arrow.gandiva.expression.ExpressionTree; +import org.apache.arrow.gandiva.expression.TreeBuilder; +import org.apache.arrow.gandiva.expression.TreeNode; +import org.apache.arrow.vector.types.pojo.Field; +import org.apache.arrow.vector.types.pojo.Schema; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Measures the throughput of concurrent {@link Projector#make} calls, to quantify what removing the + * process-wide lock on {@code make()} actually buys (GH-601). + * + *

{@code Projector.make()} used to be declared {@code static synchronized}, so every LLVM module + * build in the JVM serialized on one monitor regardless of whether the calls were related. That + * monitor was {@code Projector.class}, which means the old behaviour can be reproduced exactly by + * wrapping the call in {@code synchronized (Projector.class)}. This benchmark runs both arms in a + * single JVM over identical pre-generated inputs, so the comparison does not depend on two builds + * or two machine states. + * + *

Two workloads, because a cache hit is not free: + * + *

    + *
  • cold — every call uses a distinct expression, so each one is a real LLVM compile. + * This is the case the original JFR profile was showing: unrelated concurrent queries queuing + * behind one lock. + *
  • warm — every call shares one expression, so all but the first hit Gandiva's native + * object cache. A hit still constructs a fresh TargetMachine, LLJIT, LLVMContext and Module, + * installs ~150 absolute symbols, decomposes the expression tree and relocates the cached + * object, so it is milliseconds of real work that the old lock also serialized. + *
+ * + *

Do not expect linear scaling from the unlocked arm. Two process-wide native locks remain on + * this path — the expression cache's own mutex, taken on every lookup and insert, and the JNI + * module-id map's mutex, taken on every make and every close. Where the curve flattens is where + * those start to dominate. + * + *

Disabled by default; this is a benchmark, not a test. Run it with: + * + *

+ * mvn -Parrow-jni -pl gandiva -Dtest=MakeConcurrencyBenchmark -DfailIfNoTests=false \
+ *     -Djunit.jupiter.conditions.deactivate='*' \
+ *     -Darrow.cpp.build.dir=/path/to/dir/containing/libgandiva_jni.so test
+ * 
+ * + *

Keep {@code COLD_MAKES * THREAD_COUNTS.length} well under Gandiva's native cache capacity + * (default 5000, overridable only via the {@code GANDIVA_CACHE_SIZE} environment variable, which is + * read once per process) so that LRU eviction does not perturb the cold numbers. + */ +@Disabled("perf benchmark; run explicitly, see class javadoc") +public class MakeConcurrencyBenchmark extends BaseEvaluatorTest { + + private static final int[] THREAD_COUNTS = {1, 2, 4, 8, 16}; + + /** Distinct compiles per measured cold run. Each is tens of ms, so keep this modest. */ + private static final int COLD_MAKES = 256; + + /** Cache-hit makes per measured warm run. Each is ~ms, so this can be larger. */ + private static final int WARM_MAKES = 2048; + + /** Distinct expressions burned by warmup passes, reserved outside the measured key ranges. */ + private static final int WARMUP_MAKES = 64; + + /** Monotonic source of distinct cache keys, so no two runs in this JVM collide. */ + private static final AtomicLong KEY_SEQUENCE = new AtomicLong(); + + /** Whether the timed call emulates the old {@code static synchronized} declaration. */ + private enum Arm { + LOCKED("legacy (static synchronized)"), + UNLOCKED("current (no lock)"); + + private final String label; + + Arm(String label) { + this.label = label; + } + } + + /** + * Builds one expression whose native cache key is unique to {@code key}. + * + *

Varying an integer literal is the cheapest way to get a distinct key: Gandiva's cache key is + * derived from the printed form of the expression, and changing the literal leaves the generated + * IR the same size, so per-compile cost stays flat across the sweep. Note this deliberately + * avoids any {@code like()} function — Gandiva mixes the thread id into the cache key for those, + * which would make the hit/miss ratio depend on thread count. + */ + private List distinctExpr(long key) { + Field x = Field.nullable("x", int32); + TreeNode sum = + TreeBuilder.makeFunction( + "add", + Lists.newArrayList(TreeBuilder.makeField(x), TreeBuilder.makeLiteral((int) key)), + int32); + return Lists.newArrayList(TreeBuilder.makeExpression(sum, Field.nullable("out", int32))); + } + + private Schema schema() { + return new Schema(Lists.newArrayList(Field.nullable("x", int32))); + } + + /** + * Runs {@code numMakes} Projector.make() calls across {@code numThreads} threads and returns the + * wall-clock nanos for the whole batch. + * + * @param keys the cache key to use for each call; pre-generated so expression construction is not + * inside the timed region. Repeat a value to force a cache hit. + */ + private long timeMakes(Arm arm, int numThreads, List keys) throws Exception { + final Schema schema = schema(); + + // Build every expression up front: only make() should be inside the timed region. + List> exprs = new ArrayList<>(keys.size()); + for (Long key : keys) { + exprs.add(distinctExpr(key)); + } + + ExecutorService pool = Executors.newFixedThreadPool(numThreads); + List failures = Collections.synchronizedList(new ArrayList<>()); + // All threads meet here, so the measured window is contention and not pool ramp-up. + CyclicBarrier gate = new CyclicBarrier(numThreads + 1); + + try { + List> futures = new ArrayList<>(); + for (int t = 0; t < numThreads; t++) { + final int threadIndex = t; + futures.add( + pool.submit( + () -> { + try { + gate.await(60, TimeUnit.SECONDS); + // Stripe the work so every thread does an equal share. + for (int i = threadIndex; i < exprs.size(); i += numThreads) { + makeOnce(arm, schema, exprs.get(i)); + } + } catch (Throwable e) { + failures.add(e); + } + })); + } + + gate.await(60, TimeUnit.SECONDS); + long start = System.nanoTime(); + for (Future future : futures) { + future.get(10, TimeUnit.MINUTES); + } + long elapsed = System.nanoTime() - start; + + if (!failures.isEmpty()) { + AssertionError error = new AssertionError("make() failed during benchmark"); + error.initCause(failures.get(0)); + throw error; + } + return elapsed; + } finally { + pool.shutdownNow(); + } + } + + /** + * One make/close pair. The LOCKED arm holds the {@code Projector.class} monitor across the call, + * which is exactly what {@code public static synchronized Projector make(...)} did. Verified that + * this mechanism works the same as the original sycnhronized method call. + */ + private void makeOnce(Arm arm, Schema schema, List exprs) throws Exception { + Projector projector = null; + try { + if (arm == Arm.LOCKED) { + synchronized (Projector.class) { + projector = Projector.make(schema, exprs); + } + } else { + projector = Projector.make(schema, exprs); + } + } finally { + // Projector is not AutoCloseable and has no Cleaner: a dropped reference leaks a whole LLJIT, + // which at these iteration counts will exhaust memory. + if (projector != null) { + projector.close(); + } + } + } + + /** Distinct key per call: every make() is a real LLVM compile. */ + private List coldKeys(int count) { + List keys = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + keys.add(KEY_SEQUENCE.incrementAndGet()); + } + return keys; + } + + /** One shared key: all but the first make() hits the native object cache. */ + private List warmKeys(int count) { + long key = KEY_SEQUENCE.incrementAndGet(); + List keys = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + keys.add(key); + } + return keys; + } + + private void warmup() throws Exception { + // Absorbs JVM JIT, the one-time JniLoader native load, and LLVM's one-time target init. + timeMakes(Arm.UNLOCKED, 4, coldKeys(WARMUP_MAKES)); + } + + @Test + public void benchmarkConcurrentMake() throws Exception { + warmup(); + + StringBuilder table = new StringBuilder(); + table.append("\n### Projector.make() throughput (makes/sec, higher is better)\n\n"); + table.append("cold = distinct expression per call (real LLVM compile)\n"); + table.append("warm = one shared expression (native object-cache hits)\n\n"); + table.append("| threads | cold legacy | cold current | cold speedup "); + table.append("| warm legacy | warm current | warm speedup |\n"); + table.append("|--------:|------------:|-------------:|-------------:"); + table.append("|------------:|-------------:|-------------:|\n"); + + for (int numThreads : THREAD_COUNTS) { + double coldLocked = rate(COLD_MAKES, timeMakes(Arm.LOCKED, numThreads, coldKeys(COLD_MAKES))); + double coldFree = rate(COLD_MAKES, timeMakes(Arm.UNLOCKED, numThreads, coldKeys(COLD_MAKES))); + double warmLocked = rate(WARM_MAKES, timeMakes(Arm.LOCKED, numThreads, warmKeys(WARM_MAKES))); + double warmFree = rate(WARM_MAKES, timeMakes(Arm.UNLOCKED, numThreads, warmKeys(WARM_MAKES))); + + table.append( + String.format( + "| %7d | %11.1f | %12.1f | %11.2fx | %11.1f | %12.1f | %11.2fx |%n", + numThreads, + coldLocked, + coldFree, + coldFree / coldLocked, + warmLocked, + warmFree, + warmFree / warmLocked)); + } + + table.append("\nArms: legacy = ").append(Arm.LOCKED.label); + table.append(", current = ").append(Arm.UNLOCKED.label).append('\n'); + table.append("Cores available: ").append(Runtime.getRuntime().availableProcessors()); + table.append(" (speedup is bounded by this, not by thread count)\n"); + + System.out.println(table); + } + + private static double rate(int numMakes, long elapsedNanos) { + return numMakes * 1_000_000_000.0 / elapsedNanos; + } +} diff --git a/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java b/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java index f2590226b1..f2d626f7ab 100644 --- a/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java +++ b/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -29,10 +30,13 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; import org.apache.arrow.gandiva.exceptions.GandivaException; @@ -99,12 +103,93 @@ List binaryBufs(String[] strings) { return varBufs(strings, utf16Charset); } + /** + * Builds projectors concurrently and fails if any of them errors out. + * + *

Failures here surface as a {@link GandivaException} carrying a native {@code CodeGenError}, + * not as a JVM crash -- see GH-601, where concurrent builds for the same native expression-cache + * key raced and produced "Duplicate definition of symbol 'expr_0_0'". Every exception must + * therefore be collected and re-thrown; swallowing them makes this test unable to observe the + * very bug it exists for. + * + * @param schemas schemas to pick from, one per task, round-robin + * @param exprs the expressions to compile + * @param configOptions custom configuration, or null for the default + */ + private void makeProjectorsConcurrently( + List schemas, + List exprs, + ConfigurationBuilder.ConfigOptions configOptions) + throws Exception { + final int numTasks = 1000; + ExecutorService executors = Executors.newFixedThreadPool(16); + List failures = Collections.synchronizedList(new ArrayList<>()); + + try { + IntStream.range(0, numTasks) + .forEach( + i -> { + Schema schema = schemas.get(i % schemas.size()); + executors.submit( + () -> { + Projector evaluator = null; + try { + evaluator = + configOptions == null + ? Projector.make(schema, exprs) + : Projector.make(schema, exprs, configOptions); + assertNotNull(evaluator); + } catch (Throwable t) { + failures.add(t); + } finally { + if (evaluator != null) { + try { + evaluator.close(); + } catch (Throwable t) { + failures.add(t); + } + } + } + }); + }); + executors.shutdown(); + assertTrue( + executors.awaitTermination(100, java.util.concurrent.TimeUnit.SECONDS), + "projector builds did not finish within the timeout"); + } finally { + executors.shutdownNow(); + } + + if (!failures.isEmpty()) { + AssertionError error = + new AssertionError( + failures.size() + + " of " + + numTasks + + " concurrent Projector.make() calls failed; first failure attached"); + error.initCause(failures.get(0)); + throw error; + } + } + + private List greaterThanExpr(Field a, Field b) { + TreeNode aNode = TreeBuilder.makeField(a); + TreeNode bNode = TreeBuilder.makeField(b); + List args = Lists.newArrayList(aNode, bNode); + + TreeNode cond = TreeBuilder.makeFunction("greater_than", args, boolType); + TreeNode ifNode = TreeBuilder.makeIf(cond, aNode, bNode, int64); + + ExpressionTree expr = TreeBuilder.makeExpression(ifNode, Field.nullable("c", int64)); + return Lists.newArrayList(expr); + } + private void testMakeProjectorParallel(ConfigurationBuilder.ConfigOptions configOptions) - throws InterruptedException { + throws Exception { List schemas = Lists.newArrayList(); Field a = Field.nullable("a", int64); Field b = Field.nullable("b", int64); - IntStream.range(0, 1000) + IntStream.range(0, 100) .forEach( i -> { Field c = Field.nullable("" + i, int64); @@ -112,40 +197,94 @@ private void testMakeProjectorParallel(ConfigurationBuilder.ConfigOptions config schemas.add(new Schema(cols)); }); - TreeNode aNode = TreeBuilder.makeField(a); - TreeNode bNode = TreeBuilder.makeField(b); - List args = Lists.newArrayList(aNode, bNode); + // Build projectors in parallel across many distinct schemas. This is the throughput case: + // the cache keys mostly differ, so these compilations should proceed independently. + makeProjectorsConcurrently(schemas, greaterThanExpr(a, b), configOptions); + } - TreeNode cond = TreeBuilder.makeFunction("greater_than", args, boolType); - TreeNode ifNode = TreeBuilder.makeIf(cond, aNode, bNode, int64); + /** + * The actual GH-601 shape: every thread races to build the *same* native expression-cache entry, + * starting from a genuine cache miss. + * + *

Two details matter, and both were missing from the older parallel test. First, the threads + * are released from a {@link CyclicBarrier} rather than trickling in as the executor ramps up, so + * the builds genuinely overlap. Second, each round uses a fresh schema: once a key is in the + * native cache every later build takes the cached path and the race window is gone, so a single + * key gives at most one chance to observe it. + * + *

Be aware of what this test is and is not. Against a Gandiva without the native fix it does + * reproduce the duplicate-symbol failure, but only at roughly one round in 300 -- at the round + * count below it will usually pass even on affected builds. Treat it as a smoke test that + * concurrent same-key builds succeed and produce usable projectors. The reliable regression guard + * for GH-601 is the native test (TestConcurrentMake in + * cpp/src/gandiva/tests/concurrent_make_test.cc), which reproduces within a handful of iterations + * because it races the cache read directly without the protobuf and JNI round trip in between. + */ + private void testMakeProjectorParallelSameKey(ConfigurationBuilder.ConfigOptions configOptions) + throws Exception { + final int numThreads = 16; + final int numRounds = 50; - ExpressionTree expr = TreeBuilder.makeExpression(ifNode, Field.nullable("c", int64)); - List exprs = Lists.newArrayList(expr); + Field a = Field.nullable("a", int64); + Field b = Field.nullable("b", int64); + List exprs = greaterThanExpr(a, b); - // build projectors in parallel choosing schema at random - // this should hit the same cache entry thus exposing - // any threading issues. - ExecutorService executors = Executors.newFixedThreadPool(16); + ExecutorService executors = Executors.newFixedThreadPool(numThreads); + List failures = Collections.synchronizedList(new ArrayList<>()); - IntStream.range(0, 1000) - .forEach( - i -> { + try { + for (int round = 0; round < numRounds; round++) { + // Unique per round => the first thread to arrive genuinely misses the native cache. + Field c = Field.nullable("c" + round, int64); + final Schema schema = new Schema(Lists.newArrayList(a, b, c)); + final CyclicBarrier gate = new CyclicBarrier(numThreads); + + List> futures = new ArrayList<>(); + for (int i = 0; i < numThreads; i++) { + futures.add( executors.submit( () -> { + Projector evaluator = null; try { - Projector evaluator = + gate.await(30, java.util.concurrent.TimeUnit.SECONDS); + evaluator = configOptions == null - ? Projector.make(schemas.get((int) (Math.random() * 100)), exprs) - : Projector.make( - schemas.get((int) (Math.random() * 100)), exprs, configOptions); - evaluator.close(); - } catch (GandivaException e) { - e.printStackTrace(); + ? Projector.make(schema, exprs) + : Projector.make(schema, exprs, configOptions); + assertNotNull(evaluator); + } catch (Throwable t) { + failures.add(t); + } finally { + if (evaluator != null) { + try { + evaluator.close(); + } catch (Throwable t) { + failures.add(t); + } + } } - }); - }); - executors.shutdown(); - executors.awaitTermination(100, java.util.concurrent.TimeUnit.SECONDS); + })); + } + for (Future future : futures) { + future.get(120, java.util.concurrent.TimeUnit.SECONDS); + } + } + } finally { + executors.shutdownNow(); + } + + if (!failures.isEmpty()) { + AssertionError error = + new AssertionError( + failures.size() + + " concurrent same-cache-key Projector.make() calls failed across " + + numRounds + + " rounds of " + + numThreads + + " threads; first failure attached"); + error.initCause(failures.get(0)); + throw error; + } } @Test @@ -156,6 +295,14 @@ public void testMakeProjectorParallel() throws Exception { new ConfigurationBuilder.ConfigOptions().withTargetCPU(false).withOptimize(false)); } + @Test + public void testMakeProjectorParallelSameKey() throws Exception { + // Only the default configuration. The configuration is part of the native cache key, so varying + // it just builds unrelated cache entries -- it adds runtime without exercising anything new in + // the same-key race this test is about. + testMakeProjectorParallelSameKey(null); + } + // Will be fixed by https://issues.apache.org/jira/browse/ARROW-4371 @Disabled @Test From 5584fb3460e5e0a1139c3d8e432aebe6b7699add Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Wed, 14 Oct 2026 17:24:27 +0000 Subject: [PATCH 53/63] Pass bundled Abseil include dir to Gandiva JNI build on macOS Ports the JNI part of upstream GH-1242 (#1264) to the fork's macOS build script, which replaces the upstream preset with explicit flags. Only the include dir is passed, and only when Arrow built Abseil from source; the fork keeps resolving Abseil via vcpkg when LLVM comes from vcpkg. Co-Authored-By: Claude Opus 5.5 --- ci/scripts/jni_macos_build.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 89846c2cb7..bfdd39db9a 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -203,6 +203,13 @@ elif [ -d "${build_dir}/cpp/re2_ep-install" ]; then jni_cmake_args="${jni_cmake_args} -Dre2_ROOT=${build_dir}/cpp/re2_ep-install" fi +# Bundled Protobuf headers include Abseil, so point the Gandiva JNI build at the +# bundled Abseil headers if Arrow built them (see upstream GH-1242). +absl_include_dir="${build_dir}/cpp/_deps/absl-src" +if [ -d "${absl_include_dir}/absl" ]; then + jni_cmake_args="${jni_cmake_args} -DARROW_JAVA_JNI_ABSL_INCLUDE_DIR=${absl_include_dir}" +fi + export JAVA_JNI_CMAKE_ARGS="${jni_cmake_args}" "${source_dir}/ci/scripts/jni_build.sh" \ "${source_dir}" \ From 1f2e570d56a1eb4e2515c44d6b1c8460e9431eef Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Thu, 15 Oct 2026 21:33:02 +0000 Subject: [PATCH 54/63] Fix JNI jar builds against Arrow 26 Linux: Arrow 26 requires C++20, and the vcpkg clang used to build Gandiva's precompiled bitcode does not find the gcc-toolset libstdc++, so it falls back to the system one, which lacks and . Pass the host compiler's include directories via ARROW_GANDIVA_PC_CXX_FLAGS, as Arrow's cpp_build.sh does. macOS: Arrow 26 adds LLVM 23.1/22.1 ahead of 21.1 in ARROW_LLVM_VERSIONS. FindLLVMAlt tries them newest-first, and the first version mismatch resets LLVM_DIR to NOTFOUND, so the vcpkg LLVM 21 was never found. Pass LLVM_ROOT, which FindLLVMAlt reuses as a hint for every version. Co-Authored-By: Claude Opus 5.5 --- ci/scripts/jni_macos_build.sh | 4 +++- ci/scripts/jni_manylinux_build.sh | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index bfdd39db9a..e4f5dec353 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -98,7 +98,9 @@ if [ -n "${VCPKG_ROOT_LOCAL:-}" ]; then vcpkg_installed="${VCPKG_ROOT_LOCAL}/installed/${vcpkg_triplet}" llvm_cmake_dir="${vcpkg_installed}/share/llvm" if [ -d "${llvm_cmake_dir}" ]; then - llvm_dir_arg="-DLLVM_DIR=${llvm_cmake_dir}" + # Use LLVM_ROOT, not LLVM_DIR: Arrow's FindLLVMAlt tries each supported LLVM + # version newest-first, and the first mismatch resets LLVM_DIR to NOTFOUND. + llvm_dir_arg="-DLLVM_ROOT=${vcpkg_installed}" # vcpkg's clang needs to know where to find system headers # Arrow's GandivaAddBitcode.cmake uses CMAKE_OSX_SYSROOT to set SDKROOT env var diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index c750031f35..0a79006ca6 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -86,11 +86,18 @@ export AWS_EC2_METADATA_DISABLED=TRUE install_dir="${build_dir}/cpp-install" +# Gandiva compiles its precompiled bitcode with LLVM's clang, which does not find +# the gcc-toolset libstdc++ and falls back to the system one (too old for C++20). +# Pass the host compiler's include directories, as Arrow's cpp_build.sh does. +gandiva_pc_cxx_flags=$(echo | "${CXX:-c++}" -E -Wp,-v -xc++ - 2>&1 | + grep '^ ' | awk '{print "-isystem;" $1}' | tr '\n' ';') + cmake \ -S "${arrow_dir}/cpp" \ -B "${build_dir}/cpp" \ --preset=ninja-release-jni-linux \ -DORC_SOURCE=BUNDLED \ + -DARROW_GANDIVA_PC_CXX_FLAGS="${gandiva_pc_cxx_flags}" \ -DCMAKE_INSTALL_PREFIX="${install_dir}" cmake --build "${build_dir}/cpp" cmake --install "${build_dir}/cpp" From e6f79dc6b337f4c211f8e2e43cd377a053b757cf Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Fri, 16 Oct 2026 00:19:36 +0000 Subject: [PATCH 55/63] Use vcpkg Protobuf and Abseil for macOS JNI builds against Arrow 26 Arrow 26 bundles Protobuf 31, which requires Abseil. On macOS this broke the JNI build in three ways: - The protobuf_fc install aborts (Protobuf's install script expects protoc-gen-upb, which Arrow does not build) before installing headers, so the JNI configure could not find Protobuf. The failure was hidden by '|| true'. - Arrow picked up Homebrew's Abseil, which is shared-only, while vcpkg's RE2 is built against vcpkg's static Abseil. - With bundled Protobuf and external Abseil, Arrow does not export the Abseil dependency to static consumers, leaving Abseil symbols unresolved in the JNI libraries. Do what the Linux build does: take Abseil and Protobuf from vcpkg (the flight feature) and uninstall Homebrew's Abseil. Arrow then finds Protobuf in config mode, whose targets carry their Abseil dependencies. Without vcpkg, fall back to upstream's approach of pointing the JNI build at Arrow's Protobuf build tree. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/jarbuild.yml | 7 +++++- ci/scripts/jni_macos_build.sh | 46 +++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 28a9377944..61ca066ae2 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -314,6 +314,10 @@ jobs: # used on test We uninstall Homebrew's Protobuf to ensure using # bundled Protobuf. brew uninstall protobuf || : + # Homebrew's Abseil (left behind by Protobuf/gRPC) is shared-only. + # Uninstall it so Arrow uses vcpkg's static Abseil and Protobuf + # (the "flight" vcpkg feature below), as the Linux build does. + brew uninstall --ignore-dependencies abseil || : echo "" echo "=== Free disk space before LLVM build ===" @@ -327,7 +331,8 @@ jobs: --x-install-root=${VCPKG_ROOT_LOCAL}/installed \ --x-manifest-root=arrow/ci/vcpkg \ --overlay-ports=arrow/ci/vcpkg/overlay/llvm/ \ - --x-feature=gandiva-llvm + --x-feature=gandiva-llvm \ + --x-feature=flight echo "" echo "=== Free disk space after LLVM build ===" diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index e4f5dec353..fe952caa20 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -94,6 +94,8 @@ llvm_dir_arg="" gandiva_cxx_flags="" osx_sysroot_arg="" re2_source_arg="-Dre2_SOURCE=BUNDLED" +absl_source_arg="-Dabsl_SOURCE=BUNDLED" +protobuf_args=() if [ -n "${VCPKG_ROOT_LOCAL:-}" ]; then vcpkg_installed="${VCPKG_ROOT_LOCAL}/installed/${vcpkg_triplet}" llvm_cmake_dir="${vcpkg_installed}/share/llvm" @@ -123,6 +125,18 @@ if [ -n "${VCPKG_ROOT_LOCAL:-}" ]; then if [ -d "${re2_cmake_dir}" ]; then re2_source_arg="-Dre2_ROOT=${vcpkg_installed}" fi + + # Use vcpkg's static Abseil and Protobuf, as the Linux build does. vcpkg's RE2 + # is built against this Abseil, and Arrow 26 does not export the Abseil + # dependency of a bundled Protobuf to static consumers such as the JNI libs. + # protobuf_ROOT is for Arrow's config-mode lookup, Protobuf_ROOT for + # FindProtobuf in the JNI build. + if [ -d "${vcpkg_installed}/share/absl" ]; then + absl_source_arg="-Dabsl_ROOT=${vcpkg_installed}" + fi + if [ -d "${vcpkg_installed}/share/protobuf" ]; then + protobuf_args=("-Dprotobuf_ROOT=${vcpkg_installed}" "-DProtobuf_ROOT=${vcpkg_installed}") + fi fi fi @@ -156,13 +170,10 @@ cmake \ -DPARQUET_BUILD_EXECUTABLES=OFF \ -DPARQUET_REQUIRE_ENCRYPTION=OFF \ "${re2_source_arg}" \ + "${absl_source_arg}" \ + ${protobuf_args[@]+"${protobuf_args[@]}"} \ -GNinja cmake --build "${build_dir}/cpp" --target install -# Arrow 23+ builds Protobuf via FetchContent. The protobuf_fc target installs it -# to protobuf_fc-install so the separate JNI CMake invocation can find it. -# This target is NOT in the install dependency chain (Ninja skips ALL-only targets -# when building --target install), so we must trigger it explicitly. -cmake --build "${build_dir}/cpp" --target protobuf_fc || true github_actions_group_end if [ "${ARROW_RUN_TESTS:-}" == "ON" ]; then @@ -186,10 +197,16 @@ fi # Build up the JNI CMake args based on what's available jni_cmake_args="${llvm_dir_arg}" -# Add Protobuf path if bundled, otherwise CMake will find system Protobuf. -# Arrow 23+ uses FetchContent (protobuf_fc-install); older versions used ExternalProject (protobuf_ep-install). -if [ -d "${build_dir}/cpp/protobuf_fc-install" ]; then - jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/protobuf_fc-install" +# Protobuf for the JNI build: the vcpkg one if the C++ build used it. Otherwise +# Arrow built it via FetchContent; use its build and source trees directly as +# upstream does (installing it via the protobuf_fc target fails for Protobuf 31, +# whose install script expects protoc-gen-upb, which is not built). +# Older Arrow versions used ExternalProject (protobuf_ep-install). +if [ ${#protobuf_args[@]} -gt 0 ]; then + jni_cmake_args="${jni_cmake_args} ${protobuf_args[*]}" +elif [ -d "${build_dir}/cpp/_deps/protobuf-src" ]; then + jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/_deps/protobuf-build" + jni_cmake_args="${jni_cmake_args} -DProtobuf_SRC_ROOT_FOLDER=${build_dir}/cpp/_deps/protobuf-src" elif [ -d "${build_dir}/cpp/protobuf_ep-install" ]; then jni_cmake_args="${jni_cmake_args} -DProtobuf_ROOT=${build_dir}/cpp/protobuf_ep-install" fi @@ -205,11 +222,12 @@ elif [ -d "${build_dir}/cpp/re2_ep-install" ]; then jni_cmake_args="${jni_cmake_args} -Dre2_ROOT=${build_dir}/cpp/re2_ep-install" fi -# Bundled Protobuf headers include Abseil, so point the Gandiva JNI build at the -# bundled Abseil headers if Arrow built them (see upstream GH-1242). -absl_include_dir="${build_dir}/cpp/_deps/absl-src" -if [ -d "${absl_include_dir}/absl" ]; then - jni_cmake_args="${jni_cmake_args} -DARROW_JAVA_JNI_ABSL_INCLUDE_DIR=${absl_include_dir}" +# Point the JNI build at the same Abseil the C++ build used. With bundled +# Protobuf, its headers need the bundled Abseil headers (see upstream GH-1242). +if [ "${absl_source_arg}" != "-Dabsl_SOURCE=BUNDLED" ]; then + jni_cmake_args="${jni_cmake_args} ${absl_source_arg}" +elif [ -d "${build_dir}/cpp/_deps/absl-src/absl" ]; then + jni_cmake_args="${jni_cmake_args} -DARROW_JAVA_JNI_ABSL_INCLUDE_DIR=${build_dir}/cpp/_deps/absl-src" fi export JAVA_JNI_CMAKE_ARGS="${jni_cmake_args}" From 2db3d87c72428c94ce17262b4e85f88a6504b4cc Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Fri, 16 Oct 2026 16:39:39 +0000 Subject: [PATCH 56/63] Bundle simdjson and uriparser in macOS JNI builds Homebrew only provides shared libsimdjson and liburiparser, which the JNI libraries then depend on at runtime and the dependency check rejects (simdjson is a new dependency in Arrow 26). Build them from source, as upstream's macOS build does (GH-1242). Co-Authored-By: Claude Opus 5.5 --- ci/scripts/jni_macos_build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index fe952caa20..2dfbe963b7 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -163,6 +163,8 @@ cmake \ -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DCMAKE_UNITY_BUILD="${CMAKE_UNITY_BUILD}" \ -DGTest_SOURCE=BUNDLED \ + -Dsimdjson_SOURCE=BUNDLED \ + -Duriparser_SOURCE=BUNDLED \ "${llvm_dir_arg}" \ "${osx_sysroot_arg}" \ "${gandiva_cxx_flags}" \ From f293d367e5cf993581315cafbfa736db675d0d21 Mon Sep 17 00:00:00 2001 From: Vishal Boddu <9461605+bodduv@users.noreply.github.com> Date: Thu, 15 Oct 2026 21:46:03 +0200 Subject: [PATCH 57/63] BDX-1692: Package the Arrow C++ Parquet SDK as release artifacts (#37) * BDX-1692: Package the Arrow C++ Parquet SDK as release artifacts Publish org.apache.arrow:arrow-parquet with linux-x86_64, linux-aarch_64, osx-x86_64 and osx-aarch_64 JARs. Each holds the static Arrow C++ Parquet libraries, headers and an arrow-parquet.pc built from the same Arrow C++ revision as the JNI libraries. A smoke test links and runs against every staged package. The Linux and macOS arm64 packages reuse the existing JNI build. The macOS Intel package comes from a Parquet-only job, because the full JNI build exceeds the runner time limit there; it targets macOS 13.0. Download ORC and Thrift sources from archive.apache.org, since Apache mirrors no longer host the pinned versions. Co-Authored-By: Claude Opus 5.5 * BDX-1692: Drop the macOS x86_64 Arrow Parquet package Arrow Java ships no macOS x86_64 JNI libraries, so arrow-parquet follows the same platforms: linux-x86_64, linux-aarch_64 and osx-aarch_64. Remove the Parquet-only Intel job and the Thrift archive URL it needed; keep the ORC archive URL for the JNI builds. Assign pkg-config output before splitting it, so that a pkg-config failure stops the packaging script. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .github/workflows/jarbuild.yml | 14 +++ ci/scripts/arrow_parquet_package.sh | 176 ++++++++++++++++++++++++++++ ci/scripts/jni_full_build.sh | 28 +++++ ci/scripts/jni_macos_build.sh | 5 + ci/scripts/jni_manylinux_build.sh | 5 + compose.yaml | 1 + 6 files changed, 229 insertions(+) create mode 100755 ci/scripts/arrow_parquet_package.sh diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index 28a9377944..384e61115c 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -149,6 +149,11 @@ jobs: with: repository: apache/parquet-testing path: arrow/cpp/submodules/parquet-testing + - name: Use the Apache archive for the ORC source + # Apache mirrors keep only current releases; archive.apache.org keeps all of them. + run: | + orc=$(sed -n 's/^ARROW_ORC_BUILD_VERSION=//p' arrow/cpp/thirdparty/versions.txt) + echo "ARROW_ORC_URL=https://archive.apache.org/dist/orc/orc-${orc}/orc-${orc}.tar.gz" >> "${GITHUB_ENV}" - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: registry: ghcr.io @@ -216,6 +221,11 @@ jobs: with: repository: apache/parquet-testing path: arrow/cpp/submodules/parquet-testing + - name: Use the Apache archive for the ORC source + # Apache mirrors keep only current releases; archive.apache.org keeps all of them. + run: | + orc=$(sed -n 's/^ARROW_ORC_BUILD_VERSION=//p' arrow/cpp/thirdparty/versions.txt) + echo "ARROW_ORC_URL=https://archive.apache.org/dist/orc/orc-${orc}/orc-${orc}.tar.gz" >> "${GITHUB_ENV}" - name: Set up Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: @@ -402,6 +412,10 @@ jobs: test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib test -f jni/gandiva_jni/aarch_64/libgandiva_jni.dylib + for platform in linux-x86_64 linux-aarch_64 osx-aarch_64; do + test -f jni/arrow_parquet/${platform}/lib/pkgconfig/arrow-parquet.pc + done + - name: Checkout apache/arrow-testing uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/ci/scripts/arrow_parquet_package.sh b/ci/scripts/arrow_parquet_package.sh new file mode 100755 index 0000000000..bca1ae12f7 --- /dev/null +++ b/ci/scripts/arrow_parquet_package.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Stages the static Arrow C++ Parquet libraries, headers and pkg-config +# metadata of an Arrow C++ installation into +# /arrow_parquet/-, then links and runs a smoke test +# against the staged package. +# +# Usage: arrow_parquet_package.sh [] +# arrow_dir Arrow source checkout (LICENSE.txt, NOTICE.txt, git revision) +# arrow_install_dir Arrow C++ installation prefix +# dist_dir Directory that receives arrow_parquet/- +# pkgconfig_dir Optional pkg-config directory of external dependencies (e.g. vcpkg) + +set -euo pipefail + +# shellcheck source=ci/scripts/util_log.sh +. "$(dirname "${0}")/util_log.sh" + +github_actions_group_begin "Stage Arrow Parquet package" +arrow_dir=${1} +arrow_install_dir=${2} +dist_dir=${3} +dependency_pkgconfig_dir=${4:-} +cxx=${CXX:-c++} + +case "$(uname)" in +Linux) os=linux ;; +Darwin) os=osx ;; +*) + echo "Unsupported OS: $(uname)" >&2 + exit 1 + ;; +esac +arch=$(uname -m) +case "${arch}" in +arm64 | aarch64) arch=aarch_64 ;; +esac +package_dir="${dist_dir}/arrow_parquet/${os}-${arch}" +rm -rf "${package_dir}" +mkdir -p "${package_dir}/lib/pkgconfig" "${package_dir}/META-INF" +cp -R "${arrow_install_dir}/include" "${package_dir}/" +cp "${arrow_dir}/LICENSE.txt" "${package_dir}/META-INF/LICENSE" +cp "${arrow_dir}/NOTICE.txt" "${package_dir}/META-INF/NOTICE" +git -c safe.directory="${arrow_dir}" -C "${arrow_dir}" rev-parse HEAD >"${package_dir}/ARROW_CPP_REVISION" + +parquet_metadata=$(find "${arrow_install_dir}" -type f -name parquet.pc -print -quit) +if [ -z "${parquet_metadata}" ]; then + echo "Missing installed Parquet pkg-config metadata" >&2 + exit 1 +fi +PKG_CONFIG_PATH="$(dirname "${parquet_metadata}"):${dependency_pkgconfig_dir:+${dependency_pkgconfig_dir}:}${PKG_CONFIG_PATH:-}" +export PKG_CONFIG_PATH +packages=(parquet arrow-compute) +# Without an external dependency installation, Arrow bundles these into +# libarrow_bundled_dependencies.a; probing would pick up unrelated host copies. +if [ -n "${dependency_pkgconfig_dir}" ]; then + for dependency in re2 thrift liblz4 libzstd libutf8proc; do + if pkg-config --exists "${dependency}"; then + packages+=("${dependency}") + fi + done +fi +# Assign before splitting so that a pkg-config failure stops the script. +library_flags=$(pkg-config --static --libs-only-L "${packages[@]}") +read -ra library_dirs <<<"${library_flags}" +library_flags=$(pkg-config --static --libs "${packages[@]}") +read -ra libraries <<<"${library_flags}" +cpp_version=$(pkg-config --modversion parquet) + +# Copy every static archive into the package and keep only system libraries +# as external link dependencies. +link_flags=() +for flag in "${libraries[@]}"; do + case "${flag}" in + -L*) continue ;; + -lc | -lm | -ldl | -lpthread | -lrt | -lstdc++ | -lc++ | -lresolv) + link_flags+=("${flag}") + continue + ;; + -l*) + archive="" + for directory in "${library_dirs[@]}"; do + candidate="${directory#-L}/lib${flag#-l}.a" + if [ -f "${candidate}" ]; then + archive="${candidate}" + break + fi + done + if [ -z "${archive}" ]; then + archive=$("${cxx}" -print-file-name="lib${flag#-l}.a") + fi + if [ ! -f "${archive}" ]; then + if [ "${os}" = osx ] && [[ "${flag}" = -lz || "${flag}" = -lcurl ]]; then + link_flags+=("${flag}") + continue + fi + echo "Missing static dependency: ${flag}" >&2 + exit 1 + fi + cp "${archive}" "${package_dir}/lib/" + ;; + *.a) + cp "${flag}" "${package_dir}/lib/" + archive_name=$(basename "${flag}" .a) + flag="-l${archive_name#lib}" + ;; + esac + link_flags+=("${flag}") +done + +cat >"${package_dir}/lib/pkgconfig/arrow-parquet.pc" <"${smoke_dir}/smoke.cc" <<'EOF' +#include +#include +#include +#include +#include + +int main() { + if (!arrow::compute::Initialize().ok()) return 1; + arrow::Int64Builder builder; + if (!builder.Append(42).ok()) return 1; + auto values = builder.Finish().ValueOrDie(); + auto table = arrow::Table::Make(arrow::schema({arrow::field("value", arrow::int64())}), {values}); + for (auto codec : {parquet::Compression::SNAPPY, parquet::Compression::GZIP, + parquet::Compression::ZSTD}) { + auto output = arrow::io::BufferOutputStream::Create().ValueOrDie(); + auto properties = parquet::WriterProperties::Builder().compression(codec)->build(); + if (!parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), output, 1, + properties).ok()) return 1; + auto input = std::make_shared(output->Finish().ValueOrDie()); + auto reader = parquet::arrow::OpenFile(input, arrow::default_memory_pool()).ValueOrDie(); + std::shared_ptr actual; + if (!reader->ReadTable(&actual).ok() || !table->Equals(*actual)) return 1; + } +} +EOF +# Resolve flags only from the staged package to prove it is self-contained. +smoke_flags=$(PKG_CONFIG_PATH='' PKG_CONFIG_LIBDIR="${package_dir}/lib/pkgconfig" \ + pkg-config --cflags --libs arrow-parquet) +read -ra smoke_options <<<"${smoke_flags}" +"${cxx}" -std=c++20 "${smoke_dir}/smoke.cc" "${smoke_options[@]}" -o "${smoke_dir}/smoke" +"${smoke_dir}/smoke" +github_actions_group_end diff --git a/ci/scripts/jni_full_build.sh b/ci/scripts/jni_full_build.sh index 5d0aee0555..0285f1e4ac 100755 --- a/ci/scripts/jni_full_build.sh +++ b/ci/scripts/jni_full_build.sh @@ -85,6 +85,34 @@ github_actions_group_end popd github_actions_group_begin "Prepare artifacts" +# Package the staged Arrow C++ Parquet SDK as platform-classified JARs +version=$(python3 -c 'import sys, xml.etree.ElementTree as ET; print(ET.parse(sys.argv[1]).getroot().find("{http://maven.apache.org/POM/4.0.0}version").text)' "${source_dir}/pom.xml") +parquet_artifact="${dist_dir}/arrow-parquet-${version}" +parquet_dir="${jni_build_dir}/arrow_parquet" +for platform in linux-x86_64 linux-aarch_64 osx-aarch_64; do + cmp "${parquet_dir}/linux-x86_64/ARROW_CPP_REVISION" "${parquet_dir}/${platform}/ARROW_CPP_REVISION" + jar cf "${parquet_artifact}-${platform}.jar" -C "${parquet_dir}/${platform}" . +done +jar cf "${parquet_artifact}.jar" \ + -C "${parquet_dir}/linux-x86_64" META-INF \ + -C "${parquet_dir}/linux-x86_64" ARROW_CPP_REVISION +cat >"${parquet_artifact}.pom" < + 4.0.0 + org.apache.arrow + arrow-parquet + ${version} + jar + Arrow Parquet + Static Arrow C++ Parquet libraries, headers and pkg-config metadata + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + +EOF # copy all jar, zip and pom files to the distribution folder find ~/.m2/repository/org/apache/arrow \ "(" \ diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index e4f5dec353..f24735a0e8 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -218,6 +218,11 @@ export JAVA_JNI_CMAKE_ARGS="${jni_cmake_args}" "${install_dir}" \ "${build_dir}" \ "${dist_dir}" +"${source_dir}/ci/scripts/arrow_parquet_package.sh" \ + "${arrow_dir}" \ + "${install_dir}" \ + "${dist_dir}" \ + "${VCPKG_ROOT_LOCAL:+${VCPKG_ROOT_LOCAL}/installed/${vcpkg_triplet}/lib/pkgconfig}" if [ "${ARROW_USE_CCACHE}" == "ON" ]; then github_actions_group_begin "ccache statistics after build" diff --git a/ci/scripts/jni_manylinux_build.sh b/ci/scripts/jni_manylinux_build.sh index 0a79006ca6..f3ef2ebfd2 100755 --- a/ci/scripts/jni_manylinux_build.sh +++ b/ci/scripts/jni_manylinux_build.sh @@ -111,6 +111,11 @@ export JAVA_JNI_CMAKE_ARGS "${install_dir}" \ "${build_dir}" \ "${dist_dir}" +"${source_dir}/ci/scripts/arrow_parquet_package.sh" \ + "${arrow_dir}" \ + "${install_dir}" \ + "${dist_dir}" \ + "${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/lib/pkgconfig" if [ "${ARROW_USE_CCACHE}" == "ON" ]; then github_actions_group_begin "ccache statistics after build" diff --git a/compose.yaml b/compose.yaml index 7dc49b1072..936bfcd315 100644 --- a/compose.yaml +++ b/compose.yaml @@ -107,6 +107,7 @@ services: - ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated environment: ARROW_JAVA_CDATA: "ON" + ARROW_ORC_URL: CCACHE_DIR: "/ccache" command: ["/bin/bash", "-c", From c0a6bc0759d5d9778d2dcbbb4d5d65a1cf3abff4 Mon Sep 17 00:00:00 2001 From: Vishal Boddu <9461605+bodduv@users.noreply.github.com> Date: Mon, 19 Oct 2026 20:03:40 +0200 Subject: [PATCH 58/63] BDX-1692: Publish arrow-parquet under the com.dremio.arrow groupId (#38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BDX-1692: Publish arrow-parquet under the com.dremio.contrib groupId Publish the Arrow C++ Parquet SDK as com.dremio.arrow:arrow-parquet instead of org.apache.arrow:arrow-parquet. Apache does not publish an arrow-parquet artifact, but Dremio should not publish one under Apache’s org.apache.arrow groupId (product-eng-docs#330 review). Only in the POM written by ci/scripts/jni_full_build.sh changes. --- ci/scripts/jni_full_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/jni_full_build.sh b/ci/scripts/jni_full_build.sh index 0285f1e4ac..c7be6dc6e5 100755 --- a/ci/scripts/jni_full_build.sh +++ b/ci/scripts/jni_full_build.sh @@ -99,7 +99,7 @@ jar cf "${parquet_artifact}.jar" \ cat >"${parquet_artifact}.pom" < 4.0.0 - org.apache.arrow + com.dremio.arrow arrow-parquet ${version} jar From 92501887163121878159fab43715c3d4ba7a1610 Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Tue, 20 Oct 2026 17:09:37 +0000 Subject: [PATCH 59/63] Include vcpkg simdjson in the Arrow Parquet package Arrow 26 uses simdjson in libarrow and libparquet. With vcpkg providing it (the Linux builds), it is a separate static library rather than part of libarrow_bundled_dependencies.a, so the package smoke test failed to link with undefined simdjson symbols. Probe for it like the other vcpkg dependencies; vcpkg's simdjson provides a simdjson pkg-config module. Co-Authored-By: Claude Opus 5.5 --- ci/scripts/arrow_parquet_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/arrow_parquet_package.sh b/ci/scripts/arrow_parquet_package.sh index bca1ae12f7..49635e45fe 100755 --- a/ci/scripts/arrow_parquet_package.sh +++ b/ci/scripts/arrow_parquet_package.sh @@ -71,7 +71,7 @@ packages=(parquet arrow-compute) # Without an external dependency installation, Arrow bundles these into # libarrow_bundled_dependencies.a; probing would pick up unrelated host copies. if [ -n "${dependency_pkgconfig_dir}" ]; then - for dependency in re2 thrift liblz4 libzstd libutf8proc; do + for dependency in re2 thrift liblz4 libzstd libutf8proc simdjson; do if pkg-config --exists "${dependency}"; then packages+=("${dependency}") fi From 0e22dd5543c3adc7eb667aa005e79dc74533009a Mon Sep 17 00:00:00 2001 From: bodduv Date: Tue, 20 Oct 2026 18:07:09 +0200 Subject: [PATCH 60/63] Revert "BDX-1692: Publish arrow-parquet under the com.dremio.arrow groupId (#38)" This reverts commit 7866b41258b24c35380b0a7f1024d5737e26e07c. The releases repository on repo.drem.io rejects deploys under com/dremio/ (the Dremio_OSS_3rd_party content selector excludes that path), so custom-arrow-gandiva-build 1582 failed with 403 Forbidden. As agreed in #build, keep org.apache.arrow:arrow-parquet, as Dremio already does for other artifacts built from the Arrow repositories. Co-Authored-By: Claude Opus 5.5 --- ci/scripts/jni_full_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/jni_full_build.sh b/ci/scripts/jni_full_build.sh index c7be6dc6e5..0285f1e4ac 100755 --- a/ci/scripts/jni_full_build.sh +++ b/ci/scripts/jni_full_build.sh @@ -99,7 +99,7 @@ jar cf "${parquet_artifact}.jar" \ cat >"${parquet_artifact}.pom" < 4.0.0 - com.dremio.arrow + org.apache.arrow arrow-parquet ${version} jar From 5fd8b4eead71bf509c5023bbde0ba05cb0e86f4d Mon Sep 17 00:00:00 2001 From: "logan.riggs@gmail.com" Date: Tue, 20 Oct 2026 20:56:03 +0000 Subject: [PATCH 61/63] Skip probing dependencies Arrow bundled when packaging Arrow Parquet On macOS, Arrow bundles simdjson into libarrow_bundled_dependencies.a, but probing found Homebrew's shared-only simdjson and failed with 'Missing static dependency: -lsimdjson'. Read ARROW_BUNDLED_STATIC_LIBS from the installed ArrowConfig.cmake and only probe dependencies Arrow did not bundle. Co-Authored-By: Claude Opus 5.5 --- ci/scripts/arrow_parquet_package.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ci/scripts/arrow_parquet_package.sh b/ci/scripts/arrow_parquet_package.sh index 49635e45fe..0452795eab 100755 --- a/ci/scripts/arrow_parquet_package.sh +++ b/ci/scripts/arrow_parquet_package.sh @@ -70,8 +70,22 @@ export PKG_CONFIG_PATH packages=(parquet arrow-compute) # Without an external dependency installation, Arrow bundles these into # libarrow_bundled_dependencies.a; probing would pick up unrelated host copies. +# Even with one, skip each dependency Arrow bundled (e.g. simdjson on macOS, +# where Homebrew's shared-only copy would otherwise be found). if [ -n "${dependency_pkgconfig_dir}" ]; then - for dependency in re2 thrift liblz4 libzstd libutf8proc simdjson; do + bundled_libs="" + arrow_config=$(find "${arrow_install_dir}" -type f -name ArrowConfig.cmake -print -quit) + if [ -n "${arrow_config}" ]; then + bundled_libs=$(sed -n 's/^set(ARROW_BUNDLED_STATIC_LIBS "\(.*\)")$/\1/p' "${arrow_config}") + fi + # : + for entry in re2:re2::re2 thrift:thrift liblz4:lz4_static \ + libzstd:zstd::libzstd_static libutf8proc:utf8proc::utf8proc simdjson:simdjson; do + dependency=${entry%%:*} + bundled_target=${entry#*:} + if [[ ";${bundled_libs};" == *";${bundled_target};"* ]]; then + continue + fi if pkg-config --exists "${dependency}"; then packages+=("${dependency}") fi From bfa4d902eb47d08a6a03deb4161b178fb4483238 Mon Sep 17 00:00:00 2001 From: Georgii Zemlianyi Date: Wed, 4 Nov 2026 18:44:39 -0500 Subject: [PATCH 62/63] DX-128331: Bundle lz4 in the macOS JNI build --- ci/scripts/jni_macos_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/scripts/jni_macos_build.sh b/ci/scripts/jni_macos_build.sh index 07aaa301c0..5f58e612e1 100755 --- a/ci/scripts/jni_macos_build.sh +++ b/ci/scripts/jni_macos_build.sh @@ -159,6 +159,7 @@ cmake \ -DARROW_USE_CCACHE="${ARROW_USE_CCACHE}" \ -DAWSSDK_SOURCE=BUNDLED \ -DORC_SOURCE=BUNDLED \ + -Dlz4_SOURCE=BUNDLED \ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DCMAKE_UNITY_BUILD="${CMAKE_UNITY_BUILD}" \ From bf792fa7aa375692fa6c81f5c41fde3ff6ec6b30 Mon Sep 17 00:00:00 2001 From: Victor Zoubok Date: Mon, 16 Nov 2026 08:24:10 -0700 Subject: [PATCH 63/63] DX-128331: Pin ubuntu-24.04 and Java 17 for JarBuild Binaries and Verify --- .github/workflows/jarbuild.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jarbuild.yml b/.github/workflows/jarbuild.yml index b43da8bcd0..01c5eba791 100644 --- a/.github/workflows/jarbuild.yml +++ b/.github/workflows/jarbuild.yml @@ -382,7 +382,7 @@ jobs: path: jni-macos-${{ matrix.platform.arch }}.tar.gz binaries: name: Binaries - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: - jni-linux - jni-macos @@ -421,6 +421,11 @@ jobs: test -f jni/arrow_parquet/${platform}/lib/pkgconfig/arrow-parquet.pc done + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: 17 - name: Checkout apache/arrow-testing uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -498,8 +503,13 @@ jobs: matrix: os: - macos-latest - - ubuntu-latest + - ubuntu-24.04 steps: + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: 17 - name: Download release artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: