apache / apache/arrow

[FlightSQL] Support `DoExchange` (in addition to `DoPut`) to bind parameters and execute prepared statements

Open
#37,741 9 comments 0 reactions 0 assignees View on GitHub
Component: FlightRPC Type: enhancement
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
...
```

![CommandPreparedStatementQuery mmd](https://github.com/apache/arrow/assets/490673/8beb7b5f-a7ad-4c4e-bd21-19e044d822b7)

# 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.