Repository navigation
[C++][FlightRPC][ODBC] Driver fails when an endpoint location is arrow-flight-reuse-connection://? #54649
Description
Describe the bug, including details regarding any error messages, version, and platform.
When a Flight SQL server returns arrow-flight-reuse-connection://? as the location of a FlightEndpoint, the ODBC driver fails with:
No client transport implementation for arrow-flight-reuse-connection
FlightStreamChunkBuffer only calls DoGet on the existing client when the location list is empty. For any other location it calls FlightClient::Connect(endpoint_locations[0], ...), and no transport is registered for the reuse-connection scheme:
arrow/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer.cc
Lines 36 to 51 in 61f24ce
| if (endpoint_locations.empty()) { | |
| // list of Locations needs to be empty to proceed | |
| result = flight_sql_client.DoGet(call_options, ticket); | |
| } else { | |
| // If it is non-empty, the driver should create a FlightSqlClient to connect to one | |
| // of the specified Locations directly. | |
| // GH-47117: Currently a new FlightClient will be made for each partition that | |
| // returns a non-empty Location, which is then disposed of. It may be better to | |
| // cache clients because a server may report the same Locations. It would also be | |
| // good to identify when the reported Location is the same as the original | |
| // connection's Location and skip creating a FlightClient in that scenario. | |
| std::unique_ptr<FlightClient> temp_flight_client; | |
| util::ThrowIfNotOK(FlightClient::Connect(endpoint_locations[0], client_options) | |
| .Value(&temp_flight_client)); |
GH-40345 (#40084) defined this location as "fetch on the current connection" and added support for it in C++, Java and Go, and the JDBC driver handles it in ArrowFlightSqlClientHandler. The ODBC driver came later and doesn't check for it. GetInfo reads through the same buffer, so the DSN dialog's Test Connection fails too.
We hit this with a pyarrow-based Flight SQL proxy that rewrites endpoints to the reuse-connection location, using the ODBC driver built from 24.0.0 on Windows. A fix that treats the location like an empty list, plus a test in flight_sql_stream_chunk_buffer_test.cc, is ready, and I can open a PR.
Component(s)
C++, FlightRPC
Activity