-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Flight SQL server support (#6023)
This adds [Arrow Flight SQL](https://arrow.apache.org/docs/format/FlightSql.html) support to the Deephaven server, with the goal of supporting various SQL drivers built on top of Flight SQL (JDBC, ADBC, ODBC). It is limited to query statements (ie, no UPDATEs). The implementation supports ad-hoc query statements and ad-hoc looking prepared query statements, but not parameterized prepared statements. Queries are able to reference tables from the global scope by name; we might be able to expand support to other resolvers in the future, potentially with catalogs and namespaces. The scope of supported queries is guided by our Sql engine `io.deephaven.engine.sql.Sql` which is based on a Calcite query parser. It is important to note that while the Flight SQL implementation respects `io.deephaven.server.session.TicketResolver.Authorization.transform` it is **not** hooked up to `io.deephaven.auth.ServiceAuthWiring` nor `io.deephaven.server.table.validation.ColumnExpressionValidator`. So while Flight SQL does not allow users script execution, it does not limit the table operations a user may perform, nor does it restrict the calling of arbitrary functions from a formula. As such, the security posture of Flight SQL sits somewhere between "full access" and "limited access". A cookie-based authentication extension has been added to support some Flight SQL clients which don't operate via the normal Flight authentication "Authorization" header (yes, it's a misnomer), and instead expect the server to send "Set-Cookie" to the clients, and for the clients to echo back the cookie(s) via the "Cookie" header. The server will only send the authentication token as a cookie when the client sends the header and value "x-deephaven-auth-cookie-request=true". To support this, the `io.grpc.Context` has been captured and preserved during the export submission logic. The full Flight SQL action and command spectrum has been skeleton-ed out with appropriate "unimplemented" messages in anticipation that we will want to expand the scope of the Flight SQL implementation in the future. It also serves as a more explicit guide to readers of the code for what is and is not supported. Fixes #5339 --------- Co-authored-by: jianfengmao <[email protected]>
- Loading branch information
1 parent
8df9655
commit 064b7bf
Showing
61 changed files
with
5,855 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Flight SQL | ||
|
||
See [FlightSqlResolver](src/main/java/io/deephaven/server/flightsql/FlightSqlResolver.java) for documentation on | ||
Deephaven's Flight SQL service. | ||
|
||
## Client | ||
|
||
The Flight SQL client is simple constructed based on the underlying Flight client. | ||
|
||
```java | ||
FlightClient flightClient = ...; | ||
FlightSqlClient flightSqlClient = new FlightSqlClient(flightClient); | ||
``` | ||
|
||
## JDBC | ||
|
||
The default Flight SQL JDBC driver uses cookie authorization; by default, this is not enabled on the Deephaven server. | ||
To enable this, the request header "x-deephaven-auth-cookie-request" must be set to "true". | ||
|
||
Example JDBC connection string to self-signed TLS: | ||
|
||
``` | ||
jdbc:arrow-flight-sql://localhost:8443/?Authorization=Anonymous&useEncryption=1&disableCertificateVerification=1&x-deephaven-auth-cookie-request=true | ||
``` |
Oops, something went wrong.