This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new c58bfe5e81 GH-48312: [C++][FlightRPC] Standalone ODBC MSVC CI (#48313)
c58bfe5e81 is described below
commit c58bfe5e81bf828370020c1dae3b4949a8889de1
Author: Alina (Xi) Li <[email protected]>
AuthorDate: Tue Dec 16 19:57:08 2025 -0800
GH-48312: [C++][FlightRPC] Standalone ODBC MSVC CI (#48313)
### Rationale for this change
https://github.com/apache/arrow/issues/48312
### What changes are included in this PR?
- Add new ODBC workflow for Windows MSVC
- Added build fixes to enable build on MSVC CI
### Are these changes tested?
Tested in CI
### Are there any user-facing changes?
N/A
* GitHub Issue: #48312
Authored-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
.github/workflows/cpp_extra.yml | 107 +++++++++++++++++++++
ci/scripts/cpp_test.sh | 3 +-
cpp/CMakeLists.txt | 4 +-
.../arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt | 10 +-
.../flight/sql/odbc/odbc_impl/get_info_cache.cc | 6 +-
.../flight/sql/odbc/odbc_impl/odbc_connection.cc | 1 +
cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt | 3 +
.../arrow/flight/sql/odbc/tests/odbc_test_suite.h | 2 +
8 files changed, 124 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml
index 24588da733..b56b74c9a2 100644
--- a/.github/workflows/cpp_extra.yml
+++ b/.github/workflows/cpp_extra.yml
@@ -330,6 +330,112 @@ jobs:
cd cpp/examples/minimal_build
../minimal_build.build/arrow-example
+ odbc:
+ needs: check-labels
+ name: ODBC
+ runs-on: windows-2022
+ if: >-
+ needs.check-labels.outputs.force == 'true' ||
+ contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'),
'CI: Extra') ||
+ contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'),
'CI: Extra: C++')
+ timeout-minutes: 240
+ env:
+ ARROW_BUILD_SHARED: ON
+ ARROW_BUILD_STATIC: OFF
+ ARROW_BUILD_TESTS: ON
+ ARROW_BUILD_TYPE: release
+ ARROW_DEPENDENCY_SOURCE: VCPKG
+ ARROW_FLIGHT_SQL_ODBC: ON
+ ARROW_SIMD_LEVEL: AVX2
+ CMAKE_CXX_STANDARD: "17"
+ CMAKE_GENERATOR: Ninja
+ CMAKE_INSTALL_PREFIX: /usr
+ VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
+ VCPKG_DEFAULT_TRIPLET: x64-windows
+ steps:
+ - name: Disable Crash Dialogs
+ run: |
+ reg add `
+ "HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" `
+ /v DontShowUI `
+ /t REG_DWORD `
+ /d 1 `
+ /f
+ - name: Checkout Arrow
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: Download Timezone Database
+ shell: bash
+ run: ci/scripts/download_tz_database.sh
+ - name: Install cmake
+ shell: bash
+ run: |
+ ci/scripts/install_cmake.sh 4.1.2 /usr
+ - name: Install ccache
+ shell: bash
+ run: |
+ ci/scripts/install_ccache.sh 4.12.1 /usr
+ - name: Setup ccache
+ shell: bash
+ run: |
+ ci/scripts/ccache_setup.sh
+ - name: ccache info
+ id: ccache-info
+ shell: bash
+ run: |
+ echo "cache-dir=$(ccache --get-config cache_dir)" >> $GITHUB_OUTPUT
+ - name: Cache ccache
+ uses: actions/cache@v4
+ with:
+ path: ${{ steps.ccache-info.outputs.cache-dir }}
+ key: cpp-odbc-ccache-windows-x64-${{ hashFiles('cpp/**') }}
+ restore-keys: cpp-odbc-ccache-windows-x64-
+ - name: Checkout vcpkg
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ path: vcpkg
+ repository: microsoft/vcpkg
+ - name: Bootstrap vcpkg
+ run: |
+ vcpkg\bootstrap-vcpkg.bat
+ $VCPKG_ROOT = $(Resolve-Path -LiteralPath "vcpkg").ToString()
+ Write-Output ${VCPKG_ROOT} | `
+ Out-File -FilePath ${Env:GITHUB_PATH} -Encoding utf8 -Append
+ Write-Output "VCPKG_ROOT=${VCPKG_ROOT}" | `
+ Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
+ - name: Setup NuGet credentials for vcpkg caching
+ shell: bash
+ run: |
+ $(vcpkg fetch nuget | tail -n 1) \
+ sources add \
+ -source
"https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" \
+ -storepasswordincleartext \
+ -name "GitHub" \
+ -username "$GITHUB_REPOSITORY_OWNER" \
+ -password "${{ secrets.GITHUB_TOKEN }}"
+ $(vcpkg fetch nuget | tail -n 1) \
+ setapikey "${{ secrets.GITHUB_TOKEN }}" \
+ -source
"https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json"
+ - name: Build
+ shell: cmd
+ run: |
+ set VCPKG_ROOT_KEEP=%VCPKG_ROOT%
+ call "C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+ set VCPKG_ROOT=%VCPKG_ROOT_KEEP%
+ bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
+ - name: Register Flight SQL ODBC Driver
+ shell: cmd
+ run: |
+ call "cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd" ${{
github.workspace }}\build\cpp\%ARROW_BUILD_TYPE%\arrow_flight_sql_odbc.dll
+ # GH-48270 TODO: Resolve segementation fault during Arrow library unload
+ # GH-48269 TODO: Enable Flight & Flight SQL testing in MSVC CI
+ # GH-48547 TODO: enable ODBC tests after GH-48270 and GH-48269 are
resolved.
+
+ # GH-47787 TODO: Build ODBC installer
+
report-extra-cpp:
if: github.event_name == 'schedule' && always()
needs:
@@ -337,5 +443,6 @@ jobs:
- jni-linux
- jni-macos
- msvc-arm64
+ - odbc
uses: ./.github/workflows/report_ci.yml
secrets: inherit
diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh
index a0b77b11be..0ad59bc308 100755
--- a/ci/scripts/cpp_test.sh
+++ b/ci/scripts/cpp_test.sh
@@ -145,7 +145,8 @@ if [ "${ARROW_USE_MESON:-OFF}" = "OFF" ] && \
;;
esac
if [ -n "${VCPKG_ROOT}" ] && [ -n "${VCPKG_DEFAULT_TRIPLET}" ]; then
- CMAKE_PREFIX_PATH+=";${VCPKG_ROOT}/installed/${VCPKG_DEFAULT_TRIPLET}"
+ # Search vcpkg before <prefix>/lib/cmake.
+
CMAKE_PREFIX_PATH="${VCPKG_ROOT}/installed/${VCPKG_DEFAULT_TRIPLET};${CMAKE_PREFIX_PATH}"
fi
cmake \
-S "${source_dir}/examples/minimal_build" \
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 7286616c4f..c9f026f926 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -520,8 +520,6 @@ endif()
set(PARQUET_PC_REQUIRES "")
set(PARQUET_PC_REQUIRES_PRIVATE "")
-include(ThirdpartyToolchain)
-
# Add common flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARROW_CXXFLAGS}")
@@ -536,6 +534,8 @@ string(REPLACE "-std=c++17" "" CMAKE_C_FLAGS
${CMAKE_C_FLAGS})
# Add C++-only flags, like -std=c++17
set(CMAKE_CXX_FLAGS "${CXX_ONLY_FLAGS} ${CMAKE_CXX_FLAGS}")
+include(ThirdpartyToolchain)
+
# ASAN / TSAN / UBSAN
if(ARROW_FUZZING)
set(ARROW_USE_COVERAGE ON)
diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt
b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt
index 71a315660b..2fe9c41e3c 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt
+++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt
@@ -129,13 +129,9 @@ if(WIN32)
system_dsn.h)
endif()
-target_link_libraries(arrow_odbc_spi_impl PUBLIC arrow_flight_sql_shared
- arrow_compute_shared
Boost::locale)
-
-# Link libraries on MINGW64 and macOS
-if(MINGW OR APPLE)
- target_link_libraries(arrow_odbc_spi_impl PUBLIC ${ODBCINST})
-endif()
+target_link_libraries(arrow_odbc_spi_impl
+ PUBLIC arrow_flight_sql_shared arrow_compute_shared
Boost::locale
+ ${ODBCINST})
set_target_properties(arrow_odbc_spi_impl
PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/get_info_cache.cc
b/cpp/src/arrow/flight/sql/odbc/odbc_impl/get_info_cache.cc
index cd637be165..7d6239f24a 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/get_info_cache.cc
+++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/get_info_cache.cc
@@ -19,8 +19,6 @@
#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
-#include <sql.h>
-#include <sqlext.h>
#include "arrow/array.h"
#include "arrow/array/array_nested.h"
#include "arrow/flight/sql/api.h"
@@ -32,6 +30,10 @@
#include "arrow/flight/sql/odbc/odbc_impl/scalar_function_reporter.h"
#include "arrow/flight/sql/odbc/odbc_impl/util.h"
+// Include ODBC headers after arrow headers to avoid conflicts with
sql_info_undef.h
+#include <sql.h>
+#include <sqlext.h>
+
// Aliases for entries in SqlInfoOptions::SqlInfo that are defined here
// due to causing compilation errors conflicting with ODBC definitions.
#define ARROW_SQL_IDENTIFIER_CASE 503
diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.cc
b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.cc
index d6dfb471bd..59cdc2e12d 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.cc
+++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.cc
@@ -29,6 +29,7 @@
#include "arrow/flight/sql/odbc/odbc_impl/spi/statement.h"
#include "arrow/flight/sql/odbc/odbc_impl/util.h"
+// Include ODBC headers after arrow headers to avoid conflicts with
sql_info_undef.h
#include <odbcinst.h>
#include <sql.h>
#include <sqlext.h>
diff --git a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt
b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt
index 2f4ed9964d..39284c750b 100644
--- a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt
+++ b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt
@@ -51,3 +51,6 @@ add_arrow_test(flight_sql_odbc_test
${ODBCINST}
${SQLite3_LIBRARIES}
arrow_odbc_spi_impl)
+
+# Disable unity build due to sqlite_sql_info.cc conflict with sql.h and
sqlext.h headers.
+set_target_properties(arrow-flight-sql-odbc-test PROPERTIES UNITY_BUILD OFF)
diff --git a/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
b/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
index c349704cc5..7dd77d8fa6 100644
--- a/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
+++ b/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
@@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.
+#pragma once
+
#include "arrow/testing/gtest_util.h"
#include "arrow/util/io_util.h"
#include "arrow/util/utf8.h"