Skip to content

Conversation

@alinaliBQ
Copy link
Contributor

@alinaliBQ alinaliBQ commented Sep 5, 2025

Rationale for this change

Add initial framework for building an ODBC driver dll

What changes are included in this PR?

  • initial Flight SQL ODBC framework

Are these changes tested?

  • Yes, on local Windows environment

Are there any user-facing changes?

  • None

@github-actions
Copy link

github-actions bot commented Sep 5, 2025

⚠️ GitHub issue #47516 has been automatically assigned in GitHub to PR creator.

@alinaliBQ
Copy link
Contributor Author

alinaliBQ commented Sep 5, 2025

@lidavidm @kou Please review this PR, it is extracted from #46099
Note: I don't think I have access to add anyone as reviewer to the PR, looks like the reviewers are automatically added?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Sep 6, 2025
add_custom_target(arrow_flight_sql_odbc)

# Ensure fmt is loaded as header only
add_compile_definitions(FMT_HEADER_ONLY)
Copy link
Member

Choose a reason for hiding this comment

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

Could you use target_compile_definitions() because add_compile_definitions()'s scope is directory? We should not use directory scope commands such as add_compile_definitions() and include_directories() for newly written code.

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 changed to use target_compile_definitions

Comment on lines 40 to 44
include(FetchContent)
fetchcontent_declare(spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.zip
CONFIGURE_COMMAND
""
BUILD_COMMAND
"")
fetchcontent_makeavailable(spdlog)
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/util/logging.h instead?

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. Let me look into this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kou I have raised PR: #47645 for this change

Comment on lines +40 to +42
SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result) {
return SQL_INVALID_HANDLE;
}
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 both of the top-level SQLAllocHandle() and arrow::SQLAllocHandle()?

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. In upcoming PRs, we plan to change it to look like:

SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result) {
  return arrow::flight::sql::odbc::SQLAllocHandle(...);
}

I have separate the actual implementation of SQLAllocHandle to make this PR smaller

Copy link
Contributor Author

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

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

Checked all comments. Let me look into replacing spdlogs with arrow/util/logging.h

add_custom_target(arrow_flight_sql_odbc)

# Ensure fmt is loaded as header only
add_compile_definitions(FMT_HEADER_ONLY)
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 changed to use target_compile_definitions

Comment on lines 40 to 44
include(FetchContent)
fetchcontent_declare(spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.zip
CONFIGURE_COMMAND
""
BUILD_COMMAND
"")
fetchcontent_makeavailable(spdlog)
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. Let me look into this

Comment on lines +40 to +42
SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result) {
return SQL_INVALID_HANDLE;
}
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. In upcoming PRs, we plan to change it to look like:

SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result) {
  return arrow::flight::sql::odbc::SQLAllocHandle(...);
}

I have separate the actual implementation of SQLAllocHandle to make this PR smaller

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting changes Awaiting changes labels Sep 27, 2025
@alinaliBQ alinaliBQ force-pushed the flight-sql-odbc-first-pr branch 2 times, most recently from f3f3c59 to 587050a Compare September 29, 2025 20:44
@alinaliBQ alinaliBQ force-pushed the flight-sql-odbc-first-pr branch from 587050a to 677d1f1 Compare September 29, 2025 21:02
Create odbc.def

Remove SQLAllocHandle definitions

In-progress - fix build errors

In progress fix

Remove unneeded code

Fix build issues

Continue build fixes

Fix build issues

Address review comments

Follow-up changes

Fix Lint issues
@alinaliBQ alinaliBQ force-pushed the flight-sql-odbc-first-pr branch from 677d1f1 to 478dc97 Compare September 29, 2025 21:03
@alinaliBQ alinaliBQ requested a review from kou September 29, 2025 21:03
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

Comment on lines 20 to 22
#ifdef _WIN32
# include <windows.h>
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Should we use #include "arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/platform.h" instead? It seems that platform.h defines some macros before including windows.h.

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, that's reasonable to use. I fixed it

Copy link
Contributor Author

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

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

Addressed comments from @kou

Comment on lines 20 to 22
#ifdef _WIN32
# include <windows.h>
#endif
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, that's reasonable to use. I fixed it

@kou kou merged commit 16ceade into apache:main Oct 1, 2025
41 checks passed
@kou kou removed the awaiting merge Awaiting merge label Oct 1, 2025
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 16ceade.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Oct 15, 2025
…e#47517)

### Rationale for this change
Add initial framework for building an ODBC driver dll

### What changes are included in this PR?
- initial Flight SQL ODBC framework

### Are these changes tested?
- Yes, on local Windows environment

### Are there any user-facing changes?
- None
* PR is extracted from PR apache#46099
* GitHub Issue: apache#47516

Authored-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
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.

3 participants