fix(jdbc-v2): render array contents for named tuples - #3046
Conversation
Fixes ClickHouse#3045. Render nested JDBC Array values with deep formatting so array-of-tuple results are readable to clients that use ResultSet#getObject().
|
@claude review |
|
Claude finished @mshustov's task in 4m 7s —— View job Review: fix(jdbc-v2): render array contents for named tuples
Findings (ordered by severity)1. The output format is a one-way compatibility decision — confirm
If readable-but-approximate output is the intended contract (which is a defensible reading of #3045 — the goal is fixing 2.
3.
4. New single-test integration class instead of an existing home. (style, minor)
What's good
Docs
Tests runI could not run Maven locally (the Summary
Verdict: --- · Branch |
Summary
Arrayvalues display their nested contents.Array(Tuple(...))values with named tuple elements.java.sql.Arrayreturn type andgetArray()behavior.CHANGELOG.md.Problem
When JDBC v2 returned an array containing a named tuple, clients such as IntelliJ IDEA could display the value as:
com.clickhouse.jdbc.types.Array@54c3b772
For example:
SELECT [('550e8400-e29b-41d4-a716-446655440000')::Tuple(id UUID)];
The actual contents were available through
java.sql.Array#getArray(), but the JDBC wrapper inheritedObject#toString(), which produced an unreadable class name and identity hash.Fixes #3045.
Changes
com.clickhouse.jdbc.types.Array#toString()now uses deep array formatting viaArrays.deepToString(...).The value is now rendered as:
[[550e8400-e29b-41d4-a716-446655440000]]
Nested arrays and tuple values are also rendered correctly.
Compatibility
No public API signatures, JDBC return types, or array contents were changed.
This change only improves the textual representation returned by
com.clickhouse.jdbc.types.Array#toString().Tests
Added:
ArrayTest#testToStringForArrayOfNamedTuplesArray(Tuple(id UUID)).ArrayTupleIntegrationTest#testArrayOfNamedAndUnnamedTuplesToStringResultSet#getObject()returnsjava.sql.Array.toString()matches the contents returned byArray#getArray().