Skip to content

GH-50756: [C++][FlightSQL][ODBC] Fix Clang 20 compilation on macOS 26 - #50757

Merged
lidavidm merged 4 commits into
apache:mainfrom
HuaHuaY:fix_macos_flight_compile
Aug 5, 2026
Merged

GH-50756: [C++][FlightSQL][ODBC] Fix Clang 20 compilation on macOS 26#50757
lidavidm merged 4 commits into
apache:mainfrom
HuaHuaY:fix_macos_flight_compile

Conversation

@HuaHuaY

@HuaHuaY HuaHuaY commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix Clang 20 compilation on macOS 26.

What changes are included in this PR?

Fix four kinds of compile errors mentioned in the issue GH-50756.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@HuaHuaY
HuaHuaY requested a review from lidavidm as a code owner July 31, 2026 12:31
@HuaHuaY HuaHuaY changed the title [C++][FlightSQL][ODBC] Fix Clang 20 compilation on macOS 26 GH-50756: [C++][FlightSQL][ODBC] Fix Clang 20 compilation on macOS 26 Jul 31, 2026
@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 31, 2026
@github-actions

Copy link
Copy Markdown

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

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should resolve the discussion on the original issue before proceeding here.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Aug 3, 2026
@HuaHuaY
HuaHuaY force-pushed the fix_macos_flight_compile branch from f7986d3 to a4aa4cb Compare August 3, 2026 03:11
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Aug 3, 2026
@lidavidm
lidavidm requested a review from Copilot August 3, 2026 06:00

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems reasonable. CC @alinaliBQ

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Aug 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes Clang 20 (macOS 26) compilation failures in the Flight SQL ODBC driver by addressing deprecated Unicode conversion APIs, narrowing/precision warnings treated as errors, and unused-field warnings.

Changes:

  • Replace deprecated std::wstring_convert/std::codecvt_utf8 usage with vendored utfcpp conversions in ODBC encoding helpers.
  • Resolve narrowing/precision warnings by adding explicit casts for ODBC/Arrow indices and RapidJSON length parameters.
  • Remove an unused FlightSqlConnection private field and fix zero-initialization of tm.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.cc Cast result-set column indices to int for BindColumn calls.
cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.cc Fix narrowing warnings for metadata indexing and numeric radix handling; clarify TODOs.
cpp/src/arrow/flight/sql/odbc/odbc_impl/main.cc Cast column index to int for GetData calls in test/demo code.
cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter.cc Cast lengths to rapidjson::SizeType to avoid implicit narrowing warnings.
cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_result_set.cc Cast column index to int for Arrow RecordBatch::column(int) access.
cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.h Remove unused odbc_version_ member.
cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc Remove now-deleted odbc_version_ initializer.
cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.h Replace deprecated codecvt-based conversions with utfcpp-based conversions.
cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc Avoid implicit narrowing in byte-length calculations for SQLWCHAR conversion.
cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor.cc Fix tm initialization to avoid missing-field initializer warnings.
cpp/src/arrow/flight/sql/odbc/odbc_api.cc Remove unused variable; adjust diagnostic record index type.

Comment on lines 643 to 646
// Convert from ODBC 1 based record number to internal diagnostics 0 indexed storage
const size_t record_index = static_cast<size_t>(rec_number - 1);
const auto record_index = static_cast<uint32_t>(rec_number - 1);
if (!diagnostics->HasRecord(record_index)) {
return SQL_NO_DATA;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. The function whose actual argument is record_index has a parameter type of uint32_t, so there is no semantic difference to the original code.
  2. This function has already checked rec_number < 1 on line 602, so there is no need to check it again here.

@alinaliBQ alinaliBQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you trigger the CI for C++ Extra / ODBC debug AMD64 macOS 15-intel (pull_request) again to see if the failure can be reproduced?
It might be an existing flakey failure; just to confirm.

Comment thread cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.h
@lidavidm

lidavidm commented Aug 4, 2026

Copy link
Copy Markdown
Member

I kicked CI again.

@HuaHuaY
HuaHuaY force-pushed the fix_macos_flight_compile branch from a4aa4cb to 200d825 Compare August 5, 2026 03:26
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Aug 5, 2026
@HuaHuaY

HuaHuaY commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

The CI run that was previously re-triggered has passed. I rebased and pushed a new commit to address the comments above.

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. It seems the failures are unrelated to this PR.

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Aug 5, 2026
@lidavidm
lidavidm merged commit 669c374 into apache:main Aug 5, 2026
65 of 67 checks passed
@lidavidm lidavidm removed the awaiting merge Awaiting merge label Aug 5, 2026
@HuaHuaY
HuaHuaY deleted the fix_macos_flight_compile branch August 5, 2026 06:25
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