apache / apache/arrow-rs

FlightSQL (CLI) & Flight ignore endpoint locations

Open
#6,487 0 comments 1 reaction 0 assignees View on GitHub
arrow-flight bug
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 18h
Merged PRs (30d)
169

Description

**Describe the bug**
The FlightSQL CLI iterates over the endpoints in `FlightInfo`:

https://github.com/apache/arrow-rs/blob/3293a8c2f9062fca93bee2210d540a1d25155bf5/arrow-flight/src/bin/flight_sql_client.rs#L272-L302

However it only passes the ticket to `DoGet`, but ignores the `location` field of the respective endpoint.

**To Reproduce**
I'm not aware of system that uses different locations for `GetFlightInfo` and `DoGet`, but technically we're violating the protocol here. You could create a test server that runs on two ports and serves all but `DoGet` on one port and `DoGet` on the other, refusing the wrong method on the wrong port via an HTTP error.

**Expected behavior**
Use (or at least double-check) the location for the provided endpoints.

**Additional context**
We could fix that within the CLI code by potentially creating a new `FlightSqlServiceClient` if the location changed, however I think the [`FlightSqlServiceClient::do_get`](https://github.com/apache/arrow-rs/blob/3293a8c2f9062fca93bee2210d540a1d25155bf5/arrow-flight/src/sql/client.rs#L296-L300) and [`FlightClient::do_get`](https://github.com/apache/arrow-rs/blob/3293a8c2f9062fca93bee2210d540a1d25155bf5/arrow-flight/src/client.rs#L206) interface are somewhat misleading, because they suggest that you should use the same [`tonic::transport::Channel`](https://docs.rs/tonic/0.12.3/tonic/transport/struct.Channel.html) (and hence the same URI) for `GetFlightInfo` and `DoGet` -- which is not necessarily true. So while the bug manifests in the CLI, I think this is a Rust API bug.

Contributor guide

Open the contributing guide

Research direction

Start with the endpoint iteration in arrow-flight/src/bin/flight_sql_client.rs, then read FlightSqlServiceClient::do_get in arrow-flight/src/sql/client.rs and FlightClient::do_get in arrow-flight/src/client.rs. Check how endpoint locations are represented and passed through the client APIs. Done means DoGet honors the endpoint location, with behavior verified against a server that separates GetFlightInfo and DoGet across ports.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, rust
Domain
api, backend-api-design, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.