-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-48575: [C++][FlightRPC] Standalone ODBC macOS CI #48577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
Co-Authored-By: justing-bq <[email protected]> Co-Authored-By: Victor Tsang <[email protected]> Co-Authored-By: Alina (Xi) Li <[email protected]>
Co-Authored-By: alinalibq <[email protected]> Co-Authored-By: justing-bq <[email protected]>
added changes to build in MacOS Co-authored-by: vic-tsang <[email protected]>
f652cbb to
581bfcc
Compare
| -DCMAKE_C_FLAGS="${CFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-} -I${ODBC_INCLUDE_DIR:-} -L${ODBC_LIB_DIR:-}" \ | ||
| -DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-20}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to suggestions for other locations for -I and -L 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use ARROW_CMAKE_ARGS=-DODBC_ROOT=...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kou, is it ok to use ARROW_CMAKE_ARGS+="-I${ODBC_INCLUDE_DIR:-}" in cpp_build.sh? I was looking for other examples inside arrow to pass the -I flag but most examples are inside COMMAND.
Our team has tried passing -DODBC_ROOT and it didn't resolve the header issue.
cc @justing-bq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use it in caller not in cpp_build.sh?
For example:
arrow/.github/workflows/cpp.yml
Lines 331 to 333 in 2009cc9
| ARROW_CMAKE_ARGS: >- | |
| -DARROW_PACKAGE_PREFIX=/${{ matrix.msystem_lower}} | |
| -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added export CXXFLAGS="$CXXFLAGS -I$ODBC_INCLUDE_DIR" right before calling cpp_build.sh.
| ], | ||
| "displayName": "Debug build with tests and Flight SQL", | ||
| "cacheVariables": {} | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ODBC can be built on Windows and macOS Intel/ARM but it is not available on Linux yet (we will add Linux support later), let me know if this change should be removed until Linux is also supported.
| } catch (const arrow::flight::sql::odbc::AuthenticationException& ex) { | ||
| GetDiagnostics().AddError(arrow::flight::sql::odbc::DriverException( | ||
| ex.GetMessageText(), ex.GetSqlState(), ex.GetNativeError())); | ||
| } catch (const arrow::flight::sql::odbc::NullWithoutIndicatorException& ex) { | ||
| GetDiagnostics().AddError(arrow::flight::sql::odbc::DriverException( | ||
| ex.GetMessageText(), ex.GetSqlState(), ex.GetNativeError())); | ||
| } | ||
| // on mac, DriverException doesn't catch the subclass exceptions hence we added | ||
| // the following above. | ||
| // GH-48278 TODO investigate if there is a way to catch all the subclass exceptions | ||
| // under DriverException | ||
| catch (const arrow::flight::sql::odbc::DriverException& ex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't happen...maybe clang is stricter than MSVC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is odd, it does seem like undefined behavior. clang being more strict is a possibility.
Without this change, on mac std::exception is caught instead of DriverException, so the exception is still caught but not under DriverException which is preferred
| if(WIN32) | ||
| include_directories(${ODBC_INCLUDE_DIRS}) | ||
| else() | ||
| include_directories(${ODBC_INCLUDE_DIR}) | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_include_directories would be preferable...also why is DIRS/DIR inconsistent between platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced it with target_include_directories. Regarding DIRS/DIR, it has to do with FindODBC.cmake, on Windows, ODBC_INCLUDE_DIRS is set, and on unix systems ODBC_INCLUDE_DIR is set. ODBC_INCLUDE_DIR can be empty on Windows. I added a comment to indicate this.
- Use `target_include_directories`
lidavidm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me, but I'll let people more familiar with the CI setup comment
ci/scripts/cpp_test.sh
Outdated
| exclude_tests+=("arrow-s3fs-test") | ||
| exclude_tests+=("arrow-flight-sql-odbc-test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep this list in alphabetical order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| #include "arrow/flight/sql/odbc/odbc_impl/platform.h" | ||
| #include "arrow/flight/sql/odbc/odbc_impl/spi/connection.h" | ||
|
|
||
| #if defined _WIN32 || defined _WIN64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check both of _WIN32 and _WIN64?
_WIN32 is defined for 32 bit and 64 bit Windows:
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
_WIN32Defined as 1 when the compilation target is 32-bit ARM, 64-bit ARM, x86, x64, or ARM64EC. Otherwise, undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking _WIN32 now.
| # On Windows, cmake uses suffix `DIRS` for ODBC include headers, and | ||
| # on unix, cmake uses suffix `DIR`. | ||
| if(WIN32) | ||
| target_include_directories(arrow-flight-sql-odbc-test PUBLIC ${ODBC_INCLUDE_DIRS}) | ||
| else() | ||
| target_include_directories(arrow-flight-sql-odbc-test PUBLIC ${ODBC_INCLUDE_DIR}) | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use ODBC::ODBC CMake target instead?
find_package(ODBC REQUIRED)
target_link_libraries(arrow-flight-sql-odbc-test PRIVATE ODBC::ODBC)https://cmake.org/cmake/help/latest/module/FindODBC.html#imported-targets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
.github/workflows/cpp_extra.yml
Outdated
| export LIBIODBC_DIR="$(brew --cellar libiodbc)/$(brew list --versions libiodbc | awk '{print $2}')" | ||
| echo ODBC_INCLUDE_DIR="$LIBIODBC_DIR/include" >> $GITHUB_ENV | ||
| echo ODBC_LIB_DIR="$LIBIODBC_DIR/lib" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use -DODBC_ROOT instead?
https://cmake.org/cmake/help/latest/module/FindODBC.html#example-finding-a-custom-odbc-installation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it but it didn't work for me.
| -DCMAKE_C_FLAGS="${CFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-} -I${ODBC_INCLUDE_DIR:-} -L${ODBC_LIB_DIR:-}" \ | ||
| -DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-20}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use ARROW_CMAKE_ARGS=-DODBC_ROOT=...?
alinaliBQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review Kou. My team is working on the comments locally. cc @justing-bq
| -DCMAKE_C_FLAGS="${CFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \ | ||
| -DCMAKE_CXX_FLAGS="${CXXFLAGS:-} -I${ODBC_INCLUDE_DIR:-} -L${ODBC_LIB_DIR:-}" \ | ||
| -DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-20}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kou, is it ok to use ARROW_CMAKE_ARGS+="-I${ODBC_INCLUDE_DIR:-}" in cpp_build.sh? I was looking for other examples inside arrow to pass the -I flag but most examples are inside COMMAND.
Our team has tried passing -DODBC_ROOT and it didn't resolve the header issue.
cc @justing-bq
Rationale for this change
#48575
What changes are included in this PR?
Are these changes tested?
Tested in CI and local macOS Intel and M1 environments.
Are there any user-facing changes?
N/A