From 3987150b8e38e3152fe90314507ec0066e12dfc4 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Fri, 17 Apr 2026 15:48:09 -0700 Subject: [PATCH 1/2] ODBC Linux rpm installer support * Implement RPM installer fix formatting Remove todos ODBC rpm Installer wrap up * installing `rpm` package fixed the `cpack` command issue * Fix cpack command on CI (merge into last commit when ready) Change to use `awk` so script works on both platforms Comment out `find` and `tree` steps Change build path to be under /arrow Since docker is mounted, changing build path to be in `/arrow` will allow host machine to access docker build contents TEMP - Disable non-ODBC items Add commands to find build folder Attempt to build RPM installer * not sure if `/build/cpp` can be accessed outside of docker. Hopefully it should. * add `rpm` dependency install Indicate RPM in workflow run Add rpm `postinstall` (not tested) Remove merge conflict code * Enable ODBC installer build in CI instead of `compose.yaml` Update workflow matrix Update cpp_extra.yml Fix package name ^ Conflicts: ^ cpp/src/arrow/flight/sql/odbc/CMakeLists.txt --- .github/workflows/cpp_extra.yml | 26 ++++++++++++--- .pre-commit-config.yaml | 1 + ci/docker/ubuntu-24.04-cpp.dockerfile | 1 + ci/scripts/cpp_build.sh | 1 + compose.yaml | 7 ++-- cpp/cmake_modules/DefineOptions.cmake | 6 ++++ cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 33 +++++++++++++++---- cpp/src/arrow/flight/sql/odbc/README.md | 16 +++++++++ .../flight/sql/odbc/install/linux/postinst | 30 +++++++++++++++++ 9 files changed, 107 insertions(+), 14 deletions(-) create mode 100755 cpp/src/arrow/flight/sql/odbc/install/linux/postinst diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 73b06f9deec5..e82a064a355a 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -350,7 +350,7 @@ jobs: odbc-linux: needs: check-labels - name: ODBC Linux + name: ODBC ${{ matrix.build-type }} ${{ matrix.title }} runs-on: ubuntu-latest if: >- needs.check-labels.outputs.force == 'true' || @@ -359,6 +359,15 @@ jobs: timeout-minutes: 75 strategy: fail-fast: false + matrix: + include: + - image: ubuntu-cpp-odbc + title: AMD64 Ubuntu RPM + build-type: release + format: rpm + run-options: >- + -e ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON + -e ODBC_PACKAGE_FORMAT=RPM env: ARCH: amd64 ARCHERY_DEBUG: 1 @@ -376,8 +385,8 @@ jobs: uses: actions/cache@v5 with: path: .docker - key: ubuntu-cpp-odbc-${{ hashFiles('cpp/**') }} - restore-keys: ubuntu-cpp-odbc- + key: ${{ matrix.image }}-${{ matrix.format }}-${{ hashFiles('cpp/**') }} + restore-keys: ${{ matrix.image }}-${{ matrix.format }}- - name: Setup Python on hosted runner uses: actions/setup-python@v6 with: @@ -392,7 +401,14 @@ jobs: # GH-40558: reduce ASLR to avoid ASAN/LSAN crashes sudo sysctl -w vm.mmap_rnd_bits=28 source ci/scripts/util_enable_core_dumps.sh - archery docker run ubuntu-cpp-odbc + archery docker run ${{ matrix.run-options || '' }} ${{ matrix.image }} + - name: Upload ODBC ${{ matrix.format }} to the job + if: matrix.build-type == 'release' + uses: actions/upload-artifact@v7 + with: + name: flight-sql-odbc-${{ matrix.format }}-installer + path: build/cpp/ArrowFlightSqlOdbc-*.${{ matrix.format }} + if-no-files-found: error - name: Docker Push if: >- success() && @@ -403,7 +419,7 @@ jobs: ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }} ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} continue-on-error: true - run: archery docker push ubuntu-cpp-odbc + run: archery docker push ${{ matrix.image }} odbc-macos: needs: check-labels diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e7cf88b16c1f..2fe29be6087f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -348,6 +348,7 @@ repos: ?^cpp/examples/minimal_build/run\.sh$| ?^cpp/examples/tutorial_examples/run\.sh$| ?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$| + ?^cpp/src/arrow/flight/sql/odbc/install/linux/rpm/postinstall$| ?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc\.sh$| ?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc_ini\.sh$| ?^dev/release/05-binary-upload\.sh$| diff --git a/ci/docker/ubuntu-24.04-cpp.dockerfile b/ci/docker/ubuntu-24.04-cpp.dockerfile index 074301b472dc..eca5495b12f0 100644 --- a/ci/docker/ubuntu-24.04-cpp.dockerfile +++ b/ci/docker/ubuntu-24.04-cpp.dockerfile @@ -118,6 +118,7 @@ RUN apt-get update -y -q && \ python3-venv \ rados-objclass-dev \ rapidjson-dev \ + rpm \ rsync \ tzdata \ tzdata-legacy \ diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh index 1e2f3e8f8f1a..5023c30a5df4 100755 --- a/ci/scripts/cpp_build.sh +++ b/ci/scripts/cpp_build.sh @@ -274,6 +274,7 @@ else -Dlz4_SOURCE=${lz4_SOURCE:-} \ -Dnlohmann_json_SOURCE=${nlohmann_json_SOURCE:-} \ -Dopentelemetry-cpp_SOURCE=${opentelemetry_cpp_SOURCE:-} \ + -DODBC_PACKAGE_FORMAT=${ODBC_PACKAGE_FORMAT:-} \ -DORC_SOURCE=${ORC_SOURCE:-} \ -DPARQUET_BUILD_EXAMPLES=${PARQUET_BUILD_EXAMPLES:-OFF} \ -DPARQUET_BUILD_EXECUTABLES=${PARQUET_BUILD_EXECUTABLES:-OFF} \ diff --git a/compose.yaml b/compose.yaml index f527a835a3ba..958b8597542b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -516,12 +516,15 @@ services: ARROW_PARQUET: "OFF" ARROW_S3: "OFF" ARROW_SUBSTRAIT: "OFF" + # Use `/arrow/build` so build artifacts are visible on the CI host + # Generate ODBC installer before testing # Register ODBC before running tests command: > /bin/bash -c " - /arrow/ci/scripts/cpp_build.sh /arrow /build && + /arrow/ci/scripts/cpp_build.sh /arrow /arrow/build && + (cd /arrow/build/cpp && cpack) && sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so && - /arrow/ci/scripts/cpp_test.sh /arrow /build" + /arrow/ci/scripts/cpp_test.sh /arrow /arrow/build" ubuntu-cpp-minimal: # Arrow build with minimal components/dependencies diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index 5f293f256466..5b3b0a46bb11 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -335,6 +335,12 @@ takes precedence over ccache if a storage backend is configured" ON) ARROW_FLIGHT_SQL ARROW_COMPUTE) + define_option(ARROW_FLIGHT_SQL_ODBC_INSTALLER + "Build the installer Arrow Flight SQL ODBC extension" + OFF + DEPENDS + ARROW_FLIGHT_SQL_ODBC) + define_option(ARROW_GANDIVA "Build the Gandiva libraries" OFF diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 8783d2b065d8..313dbe6e3cc6 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -155,10 +155,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") else() + set(ODBC_UNIX_FILE_NAME + "ArrowFlightSqlOdbc-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}" + ) if(APPLE) - set(CPACK_PACKAGE_FILE_NAME - "ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}" - ) + set(CPACK_PACKAGE_FILE_NAME "${ODBC_UNIX_FILE_NAME}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") set(CPACK_SET_DESTDIR ON) @@ -174,10 +175,28 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) set(ODBC_DOC_INSTALL_DIR "arrow-odbc/doc") else() # Linux - # GH-49595: TODO implement DEB installer - # GH-47977: TODO implement RPM installer - message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595") - message(STATUS "ODBC_PACKAGE_FORMAT RPM not implemented, see GH-47977") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") + if(${ODBC_PACKAGE_FORMAT} STREQUAL "DEB") + # GH-49595 TODO: implement DEB installer + message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595") + elseif(${ODBC_PACKAGE_FORMAT} STREQUAL "RPM") + set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64) + set(CPACK_GENERATOR RPM) + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_SOURCE_DIR}/install/linux/postinst") + set(CPACK_RPM_FILE_NAME "${ODBC_UNIX_FILE_NAME}.rpm") + # Disable dependency check as ODBC embeds all third party dependencies + set(CPACK_RPM_PACKAGE_AUTOREQPROV "no") + set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) + set(CPACK_RPM_COMPONENT_INSTALL ON) + else() + message(FATAL_ERROR "ODBC_PACKAGE_FORMAT '${ODBC_PACKAGE_FORMAT}' must be DEB or RPM for Linux installer." + ) + endif() + + # By default, Linux installs under /usr + set(ODBC_INSTALL_DIR "lib64/arrow-odbc/lib") + set(ODBC_DOC_INSTALL_DIR "lib64/arrow-odbc/doc") endif() # Install ODBC diff --git a/cpp/src/arrow/flight/sql/odbc/README.md b/cpp/src/arrow/flight/sql/odbc/README.md index f863ea851b8a..06e1c5fd6466 100644 --- a/cpp/src/arrow/flight/sql/odbc/README.md +++ b/cpp/src/arrow/flight/sql/odbc/README.md @@ -144,6 +144,22 @@ After ODBC has been registered, you can run the ODBC tests. It is recommended to .\cpp\build\< release | debug >\< Release | Debug>\arrow-flight-sql-odbc-test.exe ``` +## Installers + +ODBC installers are uploaded to the CI artifacts. + +| Operating System | Package Format | +|------------------|----------------| +| Windows | MSI | +| macOS | PKG | +| Linux | DEB / RPM | + +### Install `.RPM` on Ubuntu +While installing via `.DEB` installer on Ubuntu is the recommended approach, users may install `.RPM` on Ubuntu using below command +``` +alien -i --scripts ArrowFlightSqlOdbc-.rpm +``` + ## Known Limitations - Conversion from timestamp data type with specified time zone value to strings is not supported at the moment. This doesn't impact driver's usage of retrieving timestamp data from Power BI on Windows, and Excel on macOS and Windows. See GH-47504 for more context. diff --git a/cpp/src/arrow/flight/sql/odbc/install/linux/postinst b/cpp/src/arrow/flight/sql/odbc/install/linux/postinst new file mode 100755 index 000000000000..df20fab84a97 --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/install/linux/postinst @@ -0,0 +1,30 @@ +#!/bin/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. + +# Use temporary driver registration script to register ODBC driver in system DSN +odbc_install_script="/usr/lib64/arrow-odbc/lib/install_odbc.sh" +"$odbc_install_script" /usr/lib64/arrow-odbc/lib/libarrow_flight_sql_odbc.so + +# Use temporary DSN registration script to register sample system DSN +dsn_install_script="/usr/lib64/arrow-odbc/lib/install_odbc_ini.sh" +"$dsn_install_script" /etc/odbc.ini + +# clean temporary script +rm -f "$odbc_install_script" +rm -f "$dsn_install_script" From a94a2c905ba8f2afae9efd7a7cb0643b4defe7a4 Mon Sep 17 00:00:00 2001 From: justing-bq <62349012+justing-bq@users.noreply.github.com> Date: Fri, 22 May 2026 11:55:10 -0700 Subject: [PATCH 2/2] Address comments --- .github/workflows/cpp_extra.yml | 2 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 2 +- cpp/src/arrow/flight/sql/odbc/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index e82a064a355a..8a3812feb8f3 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -407,7 +407,7 @@ jobs: uses: actions/upload-artifact@v7 with: name: flight-sql-odbc-${{ matrix.format }}-installer - path: build/cpp/ArrowFlightSqlOdbc-*.${{ matrix.format }} + path: build/cpp/ArrowFlightSQLODBC-*.${{ matrix.format }} if-no-files-found: error - name: Docker Push if: >- diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 313dbe6e3cc6..c14972024889 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -156,7 +156,7 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") else() set(ODBC_UNIX_FILE_NAME - "ArrowFlightSqlOdbc-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}" + "ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}" ) if(APPLE) set(CPACK_PACKAGE_FILE_NAME "${ODBC_UNIX_FILE_NAME}") diff --git a/cpp/src/arrow/flight/sql/odbc/README.md b/cpp/src/arrow/flight/sql/odbc/README.md index 06e1c5fd6466..3fe77a9509de 100644 --- a/cpp/src/arrow/flight/sql/odbc/README.md +++ b/cpp/src/arrow/flight/sql/odbc/README.md @@ -157,7 +157,7 @@ ODBC installers are uploaded to the CI artifacts. ### Install `.RPM` on Ubuntu While installing via `.DEB` installer on Ubuntu is the recommended approach, users may install `.RPM` on Ubuntu using below command ``` -alien -i --scripts ArrowFlightSqlOdbc-.rpm +alien -i --scripts ArrowFlightSQLODBC-.rpm ``` ## Known Limitations