Skip to content

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

Open

Description

@maxevtushok

Description

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

With the official ClickHouse JDBC driver 0.9.8, IntelliJ IDEA displays Array(Tuple(id UUID)) values as:
com.clickhouse.jdbc.types.Array@54c3b772
instead of the array contents.

The same query works correctly with JDBC 0.6.0.
The issue only affects named tuples. Arrays of unnamed tuples are displayed correctly.

Steps to reproduce

  1. Connect to ClickHouse using clickhouse-jdbc:0.9.8.
  2. Execute SELECT [('550e8400-e29b-41d4-a716-446655440000')]; Result is displayed correctly.
  3. Execute SELECT [('550e8400-e29b-41d4-a716-446655440000')::Tuple(id UUID)]; Result is displayed as com.clickhouse.jdbc.types.Array@...

Error Log or Exception StackTrace

No exception is thrown.

The value is rendered as:

com.clickhouse.jdbc.types.Array@54c3b772

Expected Behaviour

Array(Tuple(id UUID)) should be returned through JDBC in a way that clients can display its contents, the same as in JDBC 0.6.0 and the same as Array(Tuple(UUID))

Code Example

SELECT [('550e8400-e29b-41d4-a716-446655440000')];

SELECT [('550e8400-e29b-41d4-a716-446655440000')::Tuple(id UUID)];

Configuration

Client Configuration

Default JDBC configuration.

Environment

  • Cloud
  • Client version: clickhouse-jdbc 0.9.8
  • Language version: N/A (observed in IntelliJ Database Viewer)
  • OS: macOS
  • IDE: IntelliJ IDEA 2026.2.0.1

ClickHouse Server

  • ClickHouse Server version: 26.3.17.56
  • ClickHouse Server non-default settings, if any: None
  • CREATE TABLE statements for tables involved: Not required (reproducible with literal values only)
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

It is unclear whether this is a JDBC driver regression or an incompatibility with IntelliJ’s database viewer, but the behavior changed between JDBC 0.6.0 and 0.9.8 and is reproducible with the SQL above.

Activity

  1. added
    jdbc
    data-types
    on Aug 17, 2026
  2. polyglotAI-bot commented on Nov 27, 2026

    @polyglotAI-bot
    Collaborator

    Recommendation: Keep open — needs info from the reporter
    Ask the reporter whether IntelliJ also shows SELECT [tuple(toUUID('550e8400-e29b-41d4-a716-446655440000'))] (an unnamed tuple) as com.clickhouse.jdbc.types.Array@…. The driver gives the same result for this query as for the named tuple, so the cause is not clear yet.

    • Category: Bug
    • Classification: impact: none · area: Data types & formats (Array(Tuple))
    • Status on main: Not run: needs IntelliJ IDEA — the JDBC results of named and unnamed tuple arrays are the same. Release 0.9.8 gives the same results as main.
    • Breaking change: No — can be done without a break, if getObject() keeps returning java.sql.Array.
    • Duplicates / related: No others.

    Analysis: The issue's contrast query [('…')] is Array(String), not a tuple array: ('…') is a string in parentheses. For Array(Tuple(UUID)) and Array(Tuple(id UUID)), jdbc-v2 returns the same java.sql.Array, the same base type OTHER (jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcUtils.java:99), and the same getArray() contents; only the type name is different. com.clickhouse.jdbc.types.Array (jdbc-v2/src/main/java/com/clickhouse/jdbc/types/Array.java:16) has no toString(), so getObject().toString() gives Array@… for every array column, also for Array(String).

    Reproduction: complete program and output

    Changed from the issue's steps: added an unnamed tuple (case 3), and the named tuple with CAST (case 4), because the issue's step 3 (case 2) fails with code 27 on ClickHouse 26.11. It runs on 26.3.

    import java.sql.Array;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.Arrays;
    import java.util.Properties;
    
    public class Repro {
        static final String URL = System.getenv().getOrDefault("CLICKHOUSE_URL", "http://localhost:8123");
        static final String PASSWORD = System.getenv().getOrDefault("CLICKHOUSE_PASSWORD", "");
    
        public static void main(String[] args) throws Exception {
            Properties props = new Properties();
            props.setProperty("user", "default");
            props.setProperty("password", PASSWORD);
            String jdbcUrl = "jdbc:clickhouse:" + URL.replaceFirst("^https?:", "") + "/default";
            String[] queries = {
                    "SELECT [('550e8400-e29b-41d4-a716-446655440000')]",                   // issue, step 2
                    "SELECT [('550e8400-e29b-41d4-a716-446655440000')::Tuple(id UUID)]",   // issue, step 3
                    "SELECT [tuple(toUUID('550e8400-e29b-41d4-a716-446655440000'))]",      // unnamed tuple
                    "SELECT [CAST(tuple(toUUID('550e8400-e29b-41d4-a716-446655440000')), 'Tuple(id UUID)')]", // named tuple
            };
            try (Connection conn = DriverManager.getConnection(jdbcUrl, props); Statement st = conn.createStatement()) {
                for (int i = 0; i < queries.length; i++) {
                    try (ResultSet rs = st.executeQuery(queries[i])) {
                        rs.next();
                        Object v = rs.getObject(1);
                        Array a = rs.getArray(1);
                        System.out.println("case " + (i + 1) + ": " + rs.getMetaData().getColumnTypeName(1)
                                + ", getColumnType=" + rs.getMetaData().getColumnType(1)
                                + ", getBaseType=" + a.getBaseType()
                                + ", getArray()=" + Arrays.deepToString((Object[]) a.getArray())
                                + ", getObject()=" + v);
                    } catch (Exception e) {
                        String m = String.valueOf(e.getMessage());
                        System.out.println("case " + (i + 1) + ": " + e.getClass().getName() + ": "
                                + m.substring(0, Math.min(m.length(), 100)));
                    }
                }
            }
        }
    }

    Output on main (8480ca001), ClickHouse 26.11.2.4:

    case 1: Array(String), getColumnType=2003, getBaseType=12, getArray()=[550e8400-e29b-41d4-a716-446655440000], getObject()=com.clickhouse.jdbc.types.Array@142269f2
    case 2: java.sql.SQLException: Code: 27. DB::Exception: Cannot parse input: expected '(' before: '550e8400-e29b-41d4-a716-446655440…
    case 3: Array(Tuple(UUID)), getColumnType=2003, getBaseType=1111, getArray()=[[550e8400-e29b-41d4-a716-446655440000]], getObject()=com.clickhouse.jdbc.types.Array@74eb909f
    case 4: Array(Tuple(id UUID)), getColumnType=2003, getBaseType=1111, getArray()=[[550e8400-e29b-41d4-a716-446655440000]], getObject()=com.clickhouse.jdbc.types.Array@5629510
    

    Output on main (8480ca001), ClickHouse 26.3.66.4 (release 0.9.8 gives the same lines):

    case 1: Array(String), getColumnType=2003, getBaseType=12, getArray()=[550e8400-e29b-41d4-a716-446655440000], getObject()=com.clickhouse.jdbc.types.Array@176b3f44
    case 2: Array(Tuple(id UUID)), getColumnType=2003, getBaseType=1111, getArray()=[[550e8400-e29b-41d4-a716-446655440000]], getObject()=com.clickhouse.jdbc.types.Array@1a760689
    case 3: Array(Tuple(UUID)), getColumnType=2003, getBaseType=1111, getArray()=[[550e8400-e29b-41d4-a716-446655440000]], getObject()=com.clickhouse.jdbc.types.Array@5dcd8c7a
    case 4: Array(Tuple(id UUID)), getColumnType=2003, getBaseType=1111, getArray()=[[550e8400-e29b-41d4-a716-446655440000]], getObject()=com.clickhouse.jdbc.types.Array@142269f2
    

    Automated triage by Polyglot AI. A maintainer makes the final decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdata-typesjdbc

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions