diff --git a/.github/actions/setup-conda-arrow/action.yml b/.github/actions/setup-conda-arrow/action.yml new file mode 100644 index 0000000000..980c6302d5 --- /dev/null +++ b/.github/actions/setup-conda-arrow/action.yml @@ -0,0 +1,60 @@ +# 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: Set up conda Arrow +description: Install Arrow and Parquet from conda-forge for CMake builds. + +inputs: + runtime-library-path: + description: Runtime library path variable to export. + required: false + default: LD_LIBRARY_PATH + extra-packages: + description: Extra conda packages to install, space separated. + required: false + default: "" + +runs: + using: composite + steps: + - name: Set up conda + uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1 + with: + miniforge-version: latest + channels: conda-forge + channel-priority: strict + activate-environment: arrow + - name: Install Arrow and Parquet + shell: bash -el {0} + env: + RUNTIME_LIBRARY_PATH: ${{ inputs.runtime-library-path }} + EXTRA_PACKAGES: ${{ inputs.extra-packages }} + run: | + read -r -a extra_packages <<< "${EXTRA_PACKAGES}" + mamba install -y "libarrow=24.0.*" "libparquet=24.0.*" "${extra_packages[@]}" + echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV" + echo "ICEBERG_REQUIRE_SYSTEM_ARROW=ON" >> "$GITHUB_ENV" + + case "${RUNTIME_LIBRARY_PATH}" in + LD_LIBRARY_PATH|DYLD_FALLBACK_LIBRARY_PATH) ;; + *) + echo "::error::Unsupported runtime-library-path: ${RUNTIME_LIBRARY_PATH}" + exit 1 + ;; + esac + runtime_path_var="${RUNTIME_LIBRARY_PATH}" + echo "${runtime_path_var}=${!runtime_path_var:+${!runtime_path_var}:}${CONDA_PREFIX}/lib" >> "$GITHUB_ENV" diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index cc411bfb7b..d97b14dac7 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -117,6 +117,11 @@ jobs: if: ${{ matrix.s3 == 'ON' }} shell: bash run: bash ci/scripts/start_minio.sh + - name: Set up conda Arrow + if: ${{ matrix.bundle_awssdk == 'OFF' }} + uses: ./.github/actions/setup-conda-arrow + with: + runtime-library-path: ${{ startsWith(matrix.runs-on, 'macos') && 'DYLD_FALLBACK_LIBRARY_PATH' || 'LD_LIBRARY_PATH' }} - name: Set up sccache uses: ./.github/actions/setup-sccache with: diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 9e8518199b..17c023293f 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -60,6 +60,8 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev libpq-dev default-libmysqlclient-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow - name: Set up sccache uses: ./.github/actions/setup-sccache with: @@ -79,6 +81,10 @@ jobs: -DICEBERG_SQL_POSTGRESQL=ON \ -DICEBERG_SQL_MYSQL=ON \ -DICEBERG_BUILD_HIVE=ON + if [[ -d _deps/vendoredarrow-src ]]; then + echo "::error::Expected Arrow from CMAKE_PREFIX_PATH, but CMake configured vendored Arrow" + exit 1 + fi cmake --build . - name: Save sccache if: always() diff --git a/.github/workflows/sanitizer_test.yml b/.github/workflows/sanitizer_test.yml index 2f21b4c3d9..bcd418130b 100644 --- a/.github/workflows/sanitizer_test.yml +++ b/.github/workflows/sanitizer_test.yml @@ -51,6 +51,8 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow - name: Set up sccache uses: ./.github/actions/setup-sccache with: @@ -63,6 +65,10 @@ jobs: mkdir build && cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DICEBERG_ENABLE_ASAN=ON -DICEBERG_ENABLE_UBSAN=ON \ -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + if [[ -d _deps/vendoredarrow-src ]]; then + echo "::error::Expected Arrow from CMAKE_PREFIX_PATH, but CMake configured vendored Arrow" + exit 1 + fi cmake --build . --verbose - name: Save sccache if: always() diff --git a/.github/workflows/sql_catalog_test.yml b/.github/workflows/sql_catalog_test.yml index e225affd45..bb4bbe2f3b 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -96,6 +96,11 @@ jobs: shell: pwsh run: | vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows roaring:x64-windows sqlite3:x64-windows + - name: Set up conda Arrow + if: ${{ !startsWith(matrix.runs-on, 'windows') }} + uses: ./.github/actions/setup-conda-arrow + with: + runtime-library-path: ${{ startsWith(matrix.runs-on, 'macos') && 'DYLD_FALLBACK_LIBRARY_PATH' || 'LD_LIBRARY_PATH' }} - name: Set up sccache uses: ./.github/actions/setup-sccache with: @@ -114,6 +119,10 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=sccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ ${{ matrix.cmake_extra_args }} + if [[ "${RUNNER_OS}" != "Windows" && -d build/_deps/vendoredarrow-src ]]; then + echo "::error::Expected Arrow from CMAKE_PREFIX_PATH, but CMake configured vendored Arrow" + exit 1 + fi - name: Build SQL catalog tests shell: bash run: cmake --build build --target sql_catalog_test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c85c7cc0a..00d0b8d5dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,6 +61,8 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow - name: Set up sccache uses: ./.github/actions/setup-sccache with: @@ -93,7 +95,9 @@ jobs: env: SCCACHE_DIR: ${{ github.workspace }}/.sccache SCCACHE_CACHE_SIZE: "2G" - ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON" + # Prebuilt Arrow exports no Thrift target, so resolve the Thrift runtime + # from conda instead of Arrow's bundled build. + ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON -DICEBERG_BUNDLE_THRIFT=OFF" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -102,6 +106,12 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow + with: + # Thrift's public C++ headers include Boost, and libboost-devel (not + # libboost-headers) is the package carrying BoostConfig.cmake. + extra-packages: libboost-devel - name: Restore sccache cache uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: @@ -139,6 +149,10 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow + with: + runtime-library-path: DYLD_FALLBACK_LIBRARY_PATH - name: Set up sccache uses: ./.github/actions/setup-sccache with: diff --git a/ci/scripts/build_iceberg.sh b/ci/scripts/build_iceberg.sh index 6a7dc607a2..090dc2fe50 100755 --- a/ci/scripts/build_iceberg.sh +++ b/ci/scripts/build_iceberg.sh @@ -88,6 +88,11 @@ fi cmake "${CMAKE_ARGS[@]}" ${source_dir} +if [[ "${ICEBERG_REQUIRE_SYSTEM_ARROW:-OFF}" == "ON" && -d _deps/vendoredarrow-src ]]; then + echo "::error::Expected Arrow from CMAKE_PREFIX_PATH, but CMake configured vendored Arrow" + exit 1 +fi + cmake --build . --target install if [[ "${run_tests}" == "ON" ]]; then ctest --output-on-failure diff --git a/cmake_modules/FindThriftAlt.cmake b/cmake_modules/FindThriftAlt.cmake index 13820998be..8ccbd9f747 100644 --- a/cmake_modules/FindThriftAlt.cmake +++ b/cmake_modules/FindThriftAlt.cmake @@ -85,10 +85,12 @@ endif() include(FindPackageHandleStandardArgs) if(TARGET thrift::thrift) - # CONFIG mode already produced the target; satisfy REQUIRED_VARS with it. + # CONFIG mode already produced the target. REQUIRED_VARS dereferences names as + # variables, so pass a variable holding the target rather than the target name. + set(ThriftAlt_TARGET thrift::thrift) find_package_handle_standard_args( ThriftAlt - REQUIRED_VARS thrift::thrift + REQUIRED_VARS ThriftAlt_TARGET VERSION_VAR ThriftAlt_VERSION) else() find_package_handle_standard_args(