Skip to content

[jdbc-v2] Option to trim trailing NULs from FixedString on read #3288

In review

Description

@ShimonSte

getString() / getObject() on a FixedString(N) column return all N bytes, trailing \0 included (BinaryStreamReader decodes new String(bytes, 0, precision)).

That matches ClickHouse semantics. But Tableau 2026.3.0 no longer hides the NULs (2026.2.1 did), so Tableau users see "Dario Medina\0\0\0…". The Tableau connector can't trim on its side, and output_format_trim_fixed_string only applies to text formats, not RowBinary.

Repro (clickhouse-jdbc 0.11.0, ClickHouse 26.10.3.7):

ResultSet rs = conn.createStatement().executeQuery("SELECT toFixedString('Dario', 10)");
rs.next();
rs.getString(1);  // "Dario\0\0\0\0\0", length 10

Ask: an opt-in connection property (e.g. jdbc_trim_fixed_string=true) that strips trailing \0 from FixedString on read. Off by default; the Tableau connector would enable it.

Related: #2929

Activity

  1. added
    jdbc-v2
    area:data-type
    area:jdbc-read
    on Nov 3, 2026
  2. added this to the 0.12.0 milestone on Nov 3, 2026
  3. removed this from the 0.12.0 milestone on Nov 11, 2026
  4. chernser commented on Nov 25, 2026

    @chernser
    Contributor

    @polyglotAI-bot please implement the fix: by default we need to cut by last valid UTF8 letter. Fix should be done only in jdbc-v2 project. Fix should only touch getString and getObject when string is requested. Note that this should be only for FixedString columns - other strings should stay as is (current behavior is made by FixedString itself, not a bug)

  5. added this to the 0.12.0 milestone on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:data-typearea:jdbc-readjdbc-v2

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions