Repository navigation
GH-1382: Implement JDBC type discovery with GetXdbcTypeInfo - #1391
hutiefang76 wants to merge 2 commits into
Conversation
Expose server type information through the existing Flight SQL JDBC metadata bridge. Convert the protocol fields to the standard JDBC columns, preserve nullable values and server order, and retain the empty-result schema. Cover real client/server round trips across batches, parameter list conversion, unknown precision, errors and allocator cleanup. Generated-by: Codex Generated-by: DeepSeek V4 Flash
|
Thank you for opening a pull request! Please label the PR with one or more of:
Also, add the 'breaking-change' label if appropriate. See CONTRIBUTING.md for details. |
| flightInfoTypeInfo = connection.getClientHandler().getXdbcTypeInfo(); | ||
| } catch (final FlightRuntimeException e) { | ||
| throw new SQLException("Failed to retrieve type info.", e); |
There was a problem hiding this comment.
This changes the behavior. getTypeInfo() used to return an empty 18-column result set without any RPC. Now any FlightRuntimeException becomes a SQLException, including UNIMPLEMENTED from servers that don't support CommandGetXdbcTypeInfo. BI tools and ORMs commonly call getTypeInfo() while setting up a connection, so those servers would now fail to connect.
Could we catch CallStatus.UNIMPLEMENTED here (and later), and return super.getTypeInfo() as before?
Only other failures should surface as SQLException.
Maybe we could add a test using setTypeInfoFlightInfoFailure(CallStatus.UNIMPLEMENTED..).
There was a problem hiding this comment.
Implemented in 284386d: both getFlightInfo and stream initialization now fall back to super.getTypeInfo() for UNIMPLEMENTED. Other Flight failures still become SQLException.
Two real Flight-server regressions check the empty 18-column JDBC schema, no rows and allocator buffers returning to baseline. With identical final test bytes, the reviewed production revision failed those two cases; the fix passes all 11 focused tests. Local affected-reactor verification also passed: Flight SQL 97 tests; JDBC Core 1255 records, including 44 existing skips; packaged driver validation 2 integration tests. Upstream CI results for this follow-up remain pending.
AI-assisted patch and reply using DeepSeek and Codex; the tests above were executed locally.
Fall back to the legacy empty JDBC result when type discovery is unimplemented. Generated-by: DeepSeek
What changed
Forward JDBC
DatabaseMetaData.getTypeInfo()toGetXdbcTypeInfoand map the response to the 18 JDBC columns. Preserve server row order and SQL NULLs, convert parameter lists to strings and the JDBC short-valued fields to SMALLINT, and retain the standard column schema for empty results.Servers that report
UNIMPLEMENTEDwhile fetching FlightInfo or initializing the type-info stream retain the previous empty JDBC result. Other Flight failures surface asSQLException. Real in-process Flight tests cover normal and multiple batches, unknown precision, NULL versus empty parameter lists, unsupported calls, server failures and allocator buffers returning to baseline after close.Validation on macOS arm64, JDK 21.0.10, using the repository-pinned Arrow test data:
024a13b4fails the two unsupported-server cases; the follow-up passes all 11 focused tests, with no failures, errors or skips.verify, including Checkstyle, Spotless and driver packaging: Flight SQL 97 tests; JDBC Core 1255 records, including 44 existing conditional skips; packaged driver validation 2 integration tests. Dependency modules retain their existing conditional skips. The optional SBOM goal requires online mode and is skipped in this offline run.ResultSetTest.testFallbackUnresolvableFlightServertiming assertion; one unchanged complete rerun passed. The current review follow-up's full verification passed on its first attempt.Closes #1382.
Upstream CI and final review for this follow-up remain pending. The required
enhancementclassification label is missing, and this account cannot add it.AI-generated patch and PR description using Codex and DeepSeek, with automated review by DeepSeek. The builds and test results above were executed locally.