Conversation
| () -> { | ||
| try { | ||
| // Best-effort: the Go driver also ignores all errors closing the session. | ||
| client.closeSession(new CloseSessionRequest()); |
There was a problem hiding this comment.
Some servers will throw an exception if this does not pass the callOptions. Looks like you went through the effort to implement those options, but they aren't used here.
There was a problem hiding this comment.
client here is FlightSqlClientWithCallOptions, so closeSession combines the connection-level call options even when no additional per-call options are supplied. The configured call options are preserved here. There’s also a test covering this with testCloseSessionReceivesConnectionHeaderExactlyOnce.
There was a problem hiding this comment.
Oh, that's right. I saw that in the original MR but forgot because that was a while ago. Thanks @unikdahal.
| () -> { | ||
| try { | ||
| // Best-effort: the Go driver also ignores all errors closing the session. | ||
| client.closeSession(new CloseSessionRequest()); |
There was a problem hiding this comment.
I think it would be worth making the private client gettable() from this class to allow a user to manage sessions while re-using the connection object. Thoughts?
There was a problem hiding this comment.
Done. I added FlightSqlConnection#getClient() returning the FlightSqlClientWithCallOptions wrapper, so callers can manage sessions while retaining the connection-level call options. I also documented that the returned client is owned by the connection and shouldn’t be closed independently.
lidavidm
left a comment
There was a problem hiding this comment.
Thanks, this needs to be rebased.
| () -> { | ||
| try { | ||
| // Best-effort: the Go driver also ignores all errors closing the session. | ||
| client.closeSession(new CloseSessionRequest()); |
|
|
||
| if (k.equals(FlightSqlConnectionProperties.SESSION_OPTIONS)) { | ||
| if (key.getType() != String.class) { | ||
| return AdbcConnection.super.getOption(key); |
There was a problem hiding this comment.
(why can't we just write super?)
There was a problem hiding this comment.
FlightSqlConnection implements AdbcConnection directly, and this is invoking the interface default method. Java requires the qualified AdbcConnection.super.getOption(...) form here; plain super.getOption(...) would look for a superclass implementation and won’t compile.
fcaf66f to
29df662
Compare
There was a problem hiding this comment.
🟡 Changes recommended
String-list parsing currently accepts trailing JSON tokens despite promising strict validation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds Flight SQL session management to the Java ADBC driver, aligning it with existing Go and Python support.
Changes:
- Adds typed session option retrieval, mutation, deletion, and JSON serialization.
- Sends
CloseSessionduring connection shutdown while preserving call options. - Adds integration and edge-case tests plus Jackson support.
File summaries
| File | Description |
|---|---|
java/pom.xml |
Defines the Jackson version. |
java/driver/flight-sql/pom.xml |
Adds Jackson Databind. |
FlightSqlConnectionProperties.java |
Defines session option keys. |
FlightSqlClientWithCallOptions.java |
Wraps session RPCs with connection options. |
FlightSqlConnection.java |
Implements session options and lifecycle handling. |
FlightSqlSessionUtil.java |
Implements conversion, validation, and JSON handling. |
FlightSqlSessionTest.java |
Tests session RPC behavior and lifecycle. |
FlightSqlSessionEdgeCaseTest.java |
Tests validation and dispatch edge cases. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** Parses a strict JSON string array (used when a string-list option is supplied as JSON). */ | ||
| static String[] parseJsonArray(String json) throws AdbcException { | ||
| try { | ||
| final JsonNode root = MAPPER.readTree(json); |
d588801 to
07afeb1
Compare
|
Looks like an unrelated CI failure. Could you rerun CI, @lidavidm? |
Summary
Add Flight SQL session management to the Java ADBC driver.
This supersedes #4444, rebuilt from current
mainas a clean single commit.GetSessionOptions,SetSessionOptions, andCloseSessionChanges since the previous review
FlightSqlClientWithCallOptions. The explicitcallOptionsargument was removed because the wrapper already applies them, avoiding duplicate options.CloseSessionis included inAutoCloseables.closeas a selectively best-effort lambda.Closes #4443.
Closes #2821.
Relates to #745.