Repository navigation
GH-1100: Report struct columns as JDBC STRUCT in Flight SQL - #1546
yucheng-du wants to merge 2 commits into
Conversation
|
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. |
Ap-95671
left a comment
There was a problem hiding this comment.
I checked the new typed JDBC Struct path on JDK 21. The existing attribute assertion passed, and the extra assertion using an empty type map reproduced the exception noted inline.
AI-assisted review with OpenAI Codex, submitted on behalf of Ap-95671.
| @Override | ||
| public <T> T getObject(Class<T> type) throws SQLException { | ||
| if (type == Struct.class) { | ||
| return type.cast(getStruct()); |
There was a problem hiding this comment.
[P2] Support an empty JDBC type map on the new Struct return value. I extended testStructMetadataAndObjectAccess with assertArrayEquals(new Object[] {12}, result.getObject(1, Struct.class).getAttributes(Map.of())). On JDK 21 this throws UnsupportedOperationException from Avatica’s StructImpl; the no-arg call directly above it returns [12]. An empty map should use the default attribute mappings. Could the returned Struct delegate that case to getAttributes() and report unsupported custom mappings as a SQLException subtype?
There was a problem hiding this comment.
Fixed in aecdef0. Empty and null type maps now return the same attributes as getAttributes(). A nonempty map throws SQLFeatureNotSupportedException. The regression test covers all three cases. I also checked nested structs and null rows over a local Flight SQL connection on JDK 21. The JDBC core Maven build and its dependencies passed (4,697 tests passed, 74 skipped).
What's Changed
Flight SQL JDBC now reports Arrow struct columns as
Types.STRUCTwith type nameSTRUCT. UntypedgetObject()still returns a map keyed by field name. Callers can also requestjava.sql.Structto read attributes in schema order.The regression test checks metadata before the first row, both object representations, and a null struct. On JDK 21 the JDBC core and its dependencies passed 4,697 tests with 74 skipped. I also checked nested structs and arrays of structs over a local Flight SQL connection.
AI assistance: GPT-6.2 Astra, ultra effort.
Closes #1100.