Skip to content

Conversation

alinaliBQ
Copy link
Contributor

@alinaliBQ alinaliBQ commented Oct 2, 2025

Rationale for this change

Enable ODBC Build In C++ Workflows to make sure ODBC can build in CI.

What changes are included in this PR?

  • Make environment variable ARROW_FLIGHT_SQL_ODBC:ON recognized in C++ build.
  • Register ODBC driver dll

Are these changes tested?

Tested in CI

Are there any user-facing changes?

No

Extracted from PR #46099

Comment on lines 22 to 23
#include <arrow/flight/types.h>
#include <boost/variant.hpp>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boost::variant is an existing dependency of flightsql-odbc. Our plan is to replace it with std::variant in future PRs

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Oct 2, 2025
@kou kou changed the title GH-46004: [C++][FlightRPC] Enable ODBC Build In C++ and Glib Workflows GH-46004: [C++][FlightRPC] Enable ODBC Build In C++ and GLib Workflows Oct 3, 2025
@@ -219,6 +219,7 @@ jobs:
ARROW_DATASET: ON
ARROW_FLIGHT: ON
ARROW_FLIGHT_SQL: ON
ARROW_FLIGHT_SQL_ODBC: ON
Copy link
Contributor Author

@alinaliBQ alinaliBQ Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alinaliBQ alinaliBQ force-pushed the gh-46004-build-odbc branch 2 times, most recently from c1d79fa to bb49757 Compare October 8, 2025 16:58
@alinaliBQ alinaliBQ changed the title GH-46004: [C++][FlightRPC] Enable ODBC Build In C++ and GLib Workflows GH-46004: [C++][FlightRPC] Enable ODBC Build In C++ Workflows Oct 8, 2025
@alinaliBQ alinaliBQ force-pushed the gh-46004-build-odbc branch 5 times, most recently from ec39f37 to 4d254df Compare October 9, 2025 19:49
@alinaliBQ alinaliBQ marked this pull request as ready for review October 9, 2025 20:22
@alinaliBQ
Copy link
Contributor Author

@lidavidm @kou The PR for building ODBC is ready for review. Please have a look, thanks

switch (msg) {
case WM_NCCREATE: {
_ASSERT(lparam != NULL);
assert(lparam != NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use ARROW_DCHECK*() instead?

# ifdef NDEBUG
# define ARROW_DFATAL ::arrow::util::ArrowLogLevel::ARROW_WARNING
// CAUTION: DCHECK_OK() always evaluates its argument, but other DCHECK*() macros
// only do so in debug mode.
# define ARROW_DCHECK(condition) \
while (false) ARROW_IGNORE_EXPR(condition); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_OK(s) \
ARROW_IGNORE_EXPR(s); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_EQ(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_NE(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_LE(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_LT(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_GE(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()
# define ARROW_DCHECK_GT(val1, val2) \
while (false) ARROW_IGNORE_EXPR(val1); \
while (false) ARROW_IGNORE_EXPR(val2); \
while (false) ::arrow::util::detail::NullLog()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I have changed to use ARROW_DCHECK here.

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver" /v Setup /t REG_SZ /d %ODBC_AMD64% /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" /v "Apache Arrow Flight SQL ODBC Driver" /t REG_SZ /d "Installed" /f

IF !ERRORLEVEL! NEQ 0 (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IF !ERRORLEVEL! NEQ 0 (
if !ERRORLEVEL! NEQ 0 (

BTW, is !ERRORLEVEL! still non 0 when the first reg add succeeded and the last reg add failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!ERRORLEVEL! should be reflecting on the last command executed, so yes !ERRORLEVEL! should be non zero if last reg add failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need _amd64 in file name?

It seems that this doesn't have any amd64 specific part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's fair, I have renamed to install_odbc

- name: Register Flight SQL ODBC Driver
shell: cmd
run: |
call "cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd" ${{github.workspace}}\build\cpp\%ARROW_BUILD_TYPE%\libarrow_flight_sql_odbc.dll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpp\src\arrow\flight\sql\odbc\script\ not ...\install\ may be better.
We will add uninstall scripts later, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I have renamed to script folder.

I am not sure if uninstall scripts are needed in this scenario and I am open to discussion. This script is for testing only. ODBC users will be able to install and uninstall the ODBC driver using a msi executable, so they won't need to use the script to install or uninstall the driver. Developers can also manually delete the driver registry if needed. This script can also be run a second time to change the registry to point to a different ODBC dll location, so the driver registry usually doesn't need to be deleted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Then how about using test\ directory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or ci\scripts\?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have renamed to tests. I think tests directory would work better in this case compared to ci\scripts since this is the only script for testing.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Oct 10, 2025
#include "arrow/flight/sql/odbc/odbc_impl/platform.h"

#include <sys/types.h>
#include <cstdint>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this missing previously?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. I recall it was causing build issues on workflows. The build works with or without this header on my local machine (Windows MSVC), but the CI builds can have problems without the header

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Oct 10, 2025
@github-actions github-actions bot added the awaiting changes Awaiting changes label Oct 11, 2025
@alinaliBQ alinaliBQ force-pushed the gh-46004-build-odbc branch from ad772ef to 032cb79 Compare October 15, 2025 00:10
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 15, 2025
@alinaliBQ alinaliBQ requested review from kou and raulcd October 15, 2025 00:11
@alinaliBQ
Copy link
Contributor Author

I think all comments have been addressed, please let me know if you have more comments, thanks

@alinaliBQ
Copy link
Contributor Author

I think the failed Python / AMD64 Windows 2022 Python 3.13 (pull_request) check is not due to the changes in this PR

@lidavidm
Copy link
Member

(FWIW, Kou/Raul are probably busy getting the new release out)

@alinaliBQ alinaliBQ force-pushed the gh-46004-build-odbc branch from 032cb79 to c880d47 Compare October 16, 2025 18:19
Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems you have pushed a change to the testing submodule reverting it back to the previous commit, can you update the submodule to point again to the latest commit?
Current commit should be:
apache/arrow-testing@9a02925

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 17, 2025
@raulcd
Copy link
Member

raulcd commented Oct 17, 2025

Thanks a lot for the PR, CI seems to be fixed now :)

Enable ODBC build in Windows MSVC workflow

Fix build issue

Register ODBC driver

ODBC driver registration is required for ODBC tests (enabled in a separate PR)

Address Sutou's comments
@alinaliBQ alinaliBQ force-pushed the gh-46004-build-odbc branch from c880d47 to 8d79a82 Compare October 17, 2025 18:55
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 17, 2025
@alinaliBQ
Copy link
Contributor Author

it seems you have pushed a change to the testing submodule reverting it back to the previous commit, can you update the submodule to point again to the latest commit? Current commit should be: apache/arrow-testing@9a02925

Good catch, I have fixed it and reverted the testing submodule change. Thanks

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants