[FlightSQL] Support `DoExchange` (in addition to `DoPut`) to bind parameters and execute prepared statements
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the enhancement requested
As suggested by @kou on https://github.com/apache/arrow/issues/37720#issuecomment-1720662204
# Usecase
1. Reduce the number of messages round trips required to run a prepared statement via FlightSQL
2. Avoid the need to (potentially) serialize bind parameters in a stateless architecture (see https://github.com/apache/arrow/issues/37720)
# Background
Currently FlightSQL requires three messages to run a prepared statement. `DoPut`, then a `GetFlightInfo` and then a `DoGet`:
```text
...
DoPut `CommandPreparedStatementQuery`
GetFlightInfo `CommandPreparedStatementQuery`
DoGet
...
```

# Proposal
By supporting [`DoExchange`](https://arrow.apache.org/docs/format/Flight.html#exchanging-data) instead of `DoPut` + `GetFlightInfo` + `DoGet` only a single round trip is needed:
```text
...
DoExchange `CommandPreparedStatementQuery`
...
```
**Benefits**:
* With this approach, parameters aren't needed to send-back to client-side
**Drawbacks**:
* the query execution result can be returned by only one server.
### Component(s)
FlightRPC
Contributor guide
Assessment
This issue has not been assessed yet.