Skip to content

[tests] clickhouse-client CLI shim: the jdbc backend writes FixedString values without their zero padding (Upstream SQL tests red since #3427) #3488

In review

Description

@polyglotAI-bot

Description

The scheduled Upstream SQL tests workflow is red on main since 2026-12-01. The job Build the shim fails one live test of the core SQL test harness (tests/clickhouse-client), so GitHub skips the upstream SQL test jobs of both backends.

The test is LiveTest.testRenderMatchesServer on the jdbc backend, for toFixedString('ab', 4): the shim writes ab, the server writes ab\0\0. The client backend is not affected. With the build job fixed, 4 allowlisted upstream SQL tests also fail on the jdbc backend for the same cause: 02154_bit_slice_for_fixedstring, 02474_extract_fixedstring_from_json, 02981_translate_fixedstring, 04037_cast_nullable_fixedstring_too_large.

Root cause. #3427 (merged 2026-11-30, for #3288) makes jdbc-v2 getString and getObject cut the trailing zero bytes of a FixedString value (ResultSetImpl.trimFixedString, jdbc-v2/src/main/java/com/clickhouse/jdbc/ResultSetImpl.java:340). This is the intended jdbc-v2 behavior (docs/features.md, "FixedString text reads"). The shim's jdbc backend reads each value with getObject (tests/clickhouse-client/src/main/java/com/clickhouse/client/cli/JdbcBackend.java:108), and TsvRenderer writes the bytes of that String for a FixedString column (TsvRenderer.java:156-164), so the zero padding that clickhouse-client prints is lost. The workflow runs on a pull request only when tests/clickhouse-client/** changes, so #3427 did not show the failure.

The fix is in the shim: write a FixedString(N) value of the jdbc backend with its zero padding, from the column type. Polyglot AI will open a fix PR for this test defect.

Steps to reproduce

  1. Start the pinned server: docker run -d --name clickhouse -p 8123:8123 -e CLICKHOUSE_SKIP_USER_SETUP=1 clickhouse/clickhouse-server:26.10.4.207
  2. Run the step of the job: CLICKHOUSE_CLIENT_CLI_LIVE=1 tests/clickhouse-client/scripts/build.sh
  3. Compare one statement on both backends with the server:
    Q="SELECT toFixedString('ab', 4), toNullable(toFixedString('y', 2)), toLowCardinality(toFixedString('z', 2)), [toFixedString('x', 3)]"
    CLICKHOUSE_CLIENT_CLI_IMPL=jdbc tests/clickhouse-client/bin/clickhouse-client --query "$Q"
    CLICKHOUSE_CLIENT_CLI_IMPL=client tests/clickhouse-client/bin/clickhouse-client --query "$Q"
    curl -s http://localhost:8123/ --data-binary "$Q"

Error Log or Exception StackTrace

[ERROR] com.clickhouse.client.cli.LiveTest.testRenderMatchesServer[jdbc, 'a\tb\\c\nd''e\0\b\f\v\x01\r', toFixedString('ab', 4), 'ünïcödé'](38)
[ERROR]   LiveTest.testRenderMatchesServer:161 expected [a\tb\\c\nd\'e\0\b\f\r	ab\0\0	ünïcödé
] but found [a\tb\\c\nd\'e\0\b\f\r	ab	ünïcödé
]
[ERROR] Tests run: 293, Failures: 1, Errors: 0, Skipped: 0

Step 3 (od -c of the output):

jdbc  :  a b \t y \t z \t [ ' x \ 0 \ 0 ' ] \n
client:  a b \ 0 \ 0 \t y \ 0 \t z \ 0 \t [ ' x \ 0 \ 0 ' ] \n
server:  a b \ 0 \ 0 \t y \ 0 \t z \ 0 \t [ ' x \ 0 \ 0 ' ] \n

02981_translate_fixedstring on the jdbc backend:

-AAA\0\0\0\0\0\0\0
+AAA

Expected Behaviour

The shim writes the server's TabSeparated text, as for the client backend: ab\0\0, y\0, z\0 (the curl output above; the server default of output_format_trim_fixed_string is 0). With only ResultSetImpl.java set back to its version before #3427, all 293 tests of the shim pass on the same server.

Code Example

// No other code: LiveTest#testRenderMatchesServer and the commands above.

Configuration

Client Configuration

// The shim's jdbc backend: jdbc:clickhouse:http://localhost:8123/default, no other properties

Environment

  • Cloud
  • Client version: main 27d63e9 (0.12.0-rc1-SNAPSHOT)
  • Language version: JDK 17 (CI: Temurin 17.0.21)
  • OS: Ubuntu 26.04 (CI runner); Linux (local reproduction)

ClickHouse Server

  • ClickHouse Server version: 26.10.4.207 (tests/clickhouse-client/clickhouse-version)
  • ClickHouse Server non-default settings, if any: none
  • CREATE TABLE statements for tables involved: none
  • Sample data for all these tables: none

Classification: impact: none · area: Docs & project (core SQL test harness)


Found by automated analysis (Polyglot AI) while working on the scheduled CI runs of main (run 46808949476). Verified against a live server.

Activity

  1. added
    tests
    on Dec 2, 2026
  2. added
    ci
    on Dec 2, 2026
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

    citests

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions