Skip to content

fix(jdbc-v2): render array contents for named tuples - #3046

Open
014-code wants to merge 1 commit into
ClickHouse:mainfrom
014-code:fix/3045-jdbc-array-tuple-display
Open

fix(jdbc-v2): render array contents for named tuples#3046
014-code wants to merge 1 commit into
ClickHouse:mainfrom
014-code:fix/3045-jdbc-array-tuple-display

Conversation

@014-code

@014-code 014-code commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make JDBC Array values display their nested contents.
  • Support readable rendering of Array(Tuple(...)) values with named tuple elements.
  • Preserve the existing java.sql.Array return type and getArray() behavior.
  • Add unit and integration regression tests.
  • Update 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 inherited Object#toString(), which produced an unreadable class name and identity hash.

Fixes #3045.

Changes

com.clickhouse.jdbc.types.Array#toString() now uses deep array formatting via Arrays.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#testToStringForArrayOfNamedTuples

    • Verifies deep formatting of Array(Tuple(id UUID)).
    • Passed: 1 test, 0 failures.
  • ArrayTupleIntegrationTest#testArrayOfNamedAndUnnamedTuplesToString

    • Runs against ClickHouse using Docker.
    • Covers both named and unnamed tuple arrays.
    • Verifies ResultSet#getObject() returns java.sql.Array.
    • Verifies toString() matches the contents returned by Array#getArray().
    • Passed: 1 test, 0 failures.

Fixes ClickHouse#3045. Render nested JDBC Array values with deep formatting so array-of-tuple results are readable to clients that use ResultSet#getObject().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in JDBC 0.9.8 when reading Array(Tuple(...)) with named tuple elements.

1 participant