Skip to content

[client-v2,jdbc-v2] Reading Array(Nullable(String)) with BinaryString enabled #2953

Open

Description

@chernser

Description

There is a claim:

Nullable array strings wrong
High Severity

It looks like readArray is using the top-level readValue for nullable array elements when binaryStringSupport is enabled. This means nested String/FixedString inside Array(Nullable(...)) are read as StringValue instead of plain String. This goes against our rule for container types and could lead to ArrayStoreException or unexpected type mismatches.

https://github.com/ClickHouse/clickhouse-java/pull/2952/changes/BASE..c74bd36aae7fd863f0691654f65c87cc9c982415#r3632548114

Activity

  1. added
    jdbc-v2
    area:data-type
    on Jul 22, 2026
  2. added this to the 0.11.0 milestone on Jul 22, 2026
  3. chernser commented on Sep 29, 2026

    @chernser
    ContributorAuthor

    @polyglotAI-bot verify it is working on main.

  4. modified the milestones: 0.11.0, 0.12.0 on Oct 1, 2026
  5. removed this from the 0.12.0 milestone on Nov 11, 2026
  6. polyglotAI-bot commented on Nov 19, 2026

    @polyglotAI-bot
    Collaborator

    Verified on main at 7506301 (client-v2 and jdbc-v2) with ClickHouse 26.10.4.207. The claim is not true on main. It was true in release 0.11.1.

    Test data: Array(Nullable(String)), Array(Array(Nullable(String))), Array(Nullable(FixedString(3))), Array(String), Map(String, Nullable(String)), Tuple(Nullable(String), String). The rows have NULLs, empty arrays, and non-UTF-8 bytes. Result with binary_string_support=true:

    Read main 0.11.1
    client-v2 getList(), getObjectArray(), getObject() all elements are String or null, at all levels queryAll() fails (error above)
    jdbc-v2 getArray().getArray(), getObject() String[], String[][] not run (the client-v2 read fails first)
    Top-level String column (check that the flag is on) client-v2 StringValue -

    With the flag off, the results are the same, but the top-level String column is a String. No StringValue is inside an array, map, or tuple. No exception occurs.

    These tests pass on main: DataTypeTests#testReadArrayOfNullableStringWithBinaryStringSupport, JdbcDataTypeTests#testReadArraysOfNullableTypes, and BinaryStreamReaderTests (added in #3343). They cover Array(Nullable(String)). They do not cover Array(Nullable(FixedString(N))) or Array(Array(Nullable(String))). I can add tests for these two types if you want.

    Separate finding (not part of this claim): on main, getStringArray() on a non-empty Array(Nullable(String)) throws ClientException: Not an array of strings, with the flag on and off. An empty array of the same column returns String[0]. I will examine it separately.

    From my side, this issue can be closed.

    Method: a devbox with a new server, and a temporary Java program that reads through client-v2 queryAll() and the jdbc-v2 driver. The 0.11.1 run used the same program with the release jars from Maven Central.

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

    area:data-typeclient-api-v2jdbc-v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions