Repository navigation
[tests] Run the ClickHouse core SQL tests through client-v2 and jdbc-v2 nightly in CI - #3389
polyglotAI-bot wants to merge 9 commits into
Conversation
…v2 and jdbc-v2 Rewrite the shim in tests/clickhouse-client so that tests/clickhouse-test of ClickHouse can drive clickhouse-java as it drives clickhouse-client: - split statements as ClientBase::executeMultiQuery does (inline data, FORMAT as an identifier, comments after the ';', test hints); - run each statement through the public API: client-v2 Client.query with ClickHouseBinaryFormatReader (backend 'client'), or jdbc-v2 Statement.execute with ResultSet.getObject (backend 'jdbc'); - keep one HTTP session (session_id) for the whole invocation, forward only log_comment, max_insert_threads, max_threads, send_logs_level, async_insert and enable_parallel_replicas; - render each value as TabSeparated text from the column type (the .reference files are the oracle of the client's decoding); - map error hints to codes with the error table of the pinned version; - start fast (C1, serial GC, a CDS archive, -Xmx384m) and write nothing to stderr except the error of a failed statement. Unit tests of the splitter, the hints, the options and the renderer, and a live test that compares the renderer with the server's FORMAT TSV. Drop commons-csv (the renderer replaces it) and depend on the clickhouse-jdbc module of this repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- clickhouse-version: the server version and the upstream tests, pinned together (26.10.4.207); - fetch-upstream.sh: a sparse, shallow checkout of v<version>-stable, and the error code table of that version (gen-error-codes.sh); - build.sh: install the clickhouse-java modules from this source, then build the shim; - run-upstream-tests.sh: run the allowlist of one backend, with shards, KNOWN_FAILURES=<id>, a version check and an optional RETRY_FAILED; - run-with-real-client.sh: the same tests through the real clickhouse-client, for triage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests of the pinned version that pass through the client and the jdbc backend (10,163 and 10,053), and 773 known failures in 31 groups (25 client bugs, 6 shim gaps). Each group header gives the cause, a reproduction with the public API, the backends and the test count. Checked three times on a fresh server at -j 6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nightly, manual (with a clickhouse_version input) and on pull requests and pushes that change the harness or the workflow. One build job (the shim with its unit and live tests), then the backends client and jdbc times 8 shards. The server image is the pinned version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README: local runs, how the shim imitates clickhouse-client, the allowlist format, how to grow the allowlist, CI, the version bump. AGENTS.md: the triage rules of the allowlist. A pointer in the root AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review gate — AI review passedClean review from: Cursor Bugbot. |
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
AI review gate — auto-approval withheldThe AI review gate is green, but the approver did not approve What to do: ask someone with write access who is not the PR author to approve this pull request. History (latest 5 heads, newest first)
|
- Turn off the runner's own retries (--dont_retry_failures). The pinned tests/clickhouse-test runs a failed test again when its output has one of its MESSAGES_TO_RETRY, and reports a pass as OK, so a flaky test could enter the allowlist. RETRY_FAILED is now the only retry. - Write the header lines of the TSVRaw...WithNames[AndTypes] formats without escapes, as the server does (TabSeparatedRowOutputFormat:: writeLine); the shim escaped them always. Live test on both backends against the server's own output, with TSVWithNames as the contrast. - Skip heredocs ($$...$$, $tag$...$tag$) in SqlText.topLevelWords, as the statement splitter does, so a FROM in a heredoc is not the FROM of an INSERT ... SELECT when the splitter looks for inline data. The same review findings as on the C# harness (clickhouse-cs#747). No allowlist change: no allowlisted or known-failure test uses a Raw format with names or a heredoc in a way that changes its result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The live header test now also has a column whose type name has a quote
(DateTime('UTC')), and TSVWithNamesAndTypes as the escaped contrast, so
it fails when only the names line of a Raw format is written without
escapes. The javadoc of OutputFormat.raw names the header lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation log The invocation log (CLICKHOUSE_CLIENT_CLI_LOG) recorded the raw command line, so the value of --password went into the file in clear. CI uploads that file as an artifact when a shard fails, and GitHub does not mask secrets in artifacts. CliOptions.redactPassword replaces the password by `***` before Main logs the arguments. It follows CliOptions.parse: - parse drops unknown short options before commons-cli reads the arguments, so in `--password -x secret` the password is `secret`. After --password, each argument is hidden up to and including the next argument that parse keeps. - After an unknown option `--p`, commons-cli also reads `-password X`, `-password=X` and `-passwordX` as the password option. These are hidden too. The other log records hold no password. The new live test checks the whole log on both backends (client-v2 and jdbc-v2) and fails without this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@cursor review again |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 239be91. Configure here.
Review of #3389: the root AGENTS.md is read with every agent request, so the pointer to the harness is removed from it. tests/clickhouse-client/ AGENTS.md now holds only the rules. The procedures (find the cause of a failure, the environment causes, the allowlist conditions, the server version bump) move to README.md, without changes to their content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
This PR makes the existing harness in
tests/clickhouse-clientrun the ClickHouse core SQL tests (tests/queries/0_stateless) through clickhouse-java, nightly in CI. The goal is to find client bugs: a failed test is information, so each failure has a cause, and each client bug is listed below. This PR does not fix client bugs.Tracking issue: ClickHouse/integrations#808
The upstream runner
tests/clickhouse-teststartsclickhouse-clientfor each test and compares the output with the.referencefile. The shim imitatesclickhouse-clientwell enough for the runner to drive it without changes. It runs each statement through the public API of clickhouse-java, built from the source of this commit (never a released jar), reads each value with the normal type mapping, and writes the value asTabSeparatedtext itself. Thus the.referencefiles check the decoding of the client, not only the transport.clientClient.queryClickHouseBinaryFormatReader.readValue(i)ClickHouseColumn.getOriginalTypeName()jdbcDriverManagerStatement.executeResultSet.getObject(i)ResultSetMetaData.getColumnTypeName(i)Both backends use HTTP with one
session_idfor the whole invocation (SET,USEand temporary tables stay). The shim splits statements asClientBase::executeMultiQuerydoes (inline data,FORMATas an identifier, test hints after the;), sends each statement with its;, forwards only the command-line settings thatclickhouse-clientforwards and that the runner does not randomize, and maps error hints to codes with the error table of the pinned version. The design and the rules come from the Go harness (ClickHouse/clickhouse-go#2141).Changes
src/,pom.xml,bin/): the rewrite of the shim, its unit tests (splitter, hints, options, renderer) and live tests that compare the renderer with the server'sFORMAT TSVoutput on both backends.commons-csvis removed: the type-directed renderer replaces it. The shim depends on theclickhouse-jdbcmodule of this repository. The JVM starts fast (C1, serial GC, a CDS archive,-Xmx384m).clickhouse-version,scripts/): the server version and the upstream tests are pinned together (26.10.4.207);fetch-upstream.sh(sparse, shallow checkout ofv<version>-stable, and the error code table),build.sh,run-upstream-tests.sh(shards,KNOWN_FAILURES=<id>, version check, optionalRETRY_FAILED),run-with-real-client.sh(the same tests through the realclickhouse-client, for triage).allowlist.txt): the tests that pass, and the known failures in groups. Each group header gives the cause, a reproduction with the public API,Issue: not filed yet, the backends and the test count..github/workflows/upstream-sql-tests.yml): nightly, manual (inputclickhouse_versionto try another server version), and on pull requests and pushes tomainthat changetests/clickhouse-client/**or the workflow. Onebuildjob (the shim with its unit and live tests), then{client, jdbc}x 8 shards. The server image is the pinned version.permissions: contents: read.tests/clickhouse-client/README.md(local runs, how the shim imitatesclickhouse-client, the allowlist format, how to grow the allowlist, CI, the version bump),tests/clickhouse-client/AGENTS.md(the triage rules, adapted from Go),CLAUDE.md(only@AGENTS.md), and one line in the rootAGENTS.md.The root
AGENTS.mdsays: "Do not modify CI workflow files (.github/workflows/**). CI changes are restricted." This PR adds one new workflow file and changes no existing workflow, because the tracking issue asks for a nightly CI job. Please review the workflow with that rule in mind.No library code changes.
tests/clickhouse-clientis a separate Maven project (not in the root reactor), so there is no CHANGELOG entry and nodocs/features.mdchange. The diff is large mostly because ofallowlist.txt(11,189 lines) and the generatederror-codes.tsv(685 lines); the commits split it by part.Results (server and tests 26.10.4.207)
Of 12,961 upstream
.sql/.sql.j2tests per backend:clientjdbcknown=jdbc(runs onclientonly)only=jdbc[untriaged]group.only=jdbc:00571_non_exist_database_when_create_materializ_view(onclient, after the current database of the session is dropped, each HTTP request fails withUNKNOWN_DATABASE).clickhouse-clienton the same server): cluster, ZooKeeper, no totals and extremes in the HTTP output, named collections, server configuration, macros, storage policies, disks, and tests that pass alone but fail in a full run (server pipeline shape and total memory under load).-j 6(CI uses-j 4), withoutRETRY_FAILED. The final list had 0 failures on both backends.KNOWN_FAILURES=type-empty-tuple(client, 35 of 35 fail) andKNOWN_FAILURES=jdbc-interval-getobject(jdbc, 31 of 31 fail) give the error of the group header.-j 6takes 20 to 23 minutes on a 32-CPU host. CI: 8 shards per backend, about 1,260 tests each, at-j 4. In the first CI run of this PR, each of the 16 shard jobs took 4.4 to 6.4 minutes (setup included), and the build job 2 minutes.Client bugs found
Not fixed in this PR, and no issues filed: the maintainers decide. Each reproduction runs through the public API: for
client,Client.query(sql)andClickHouseBinaryFormatReader.readValue; forjdbc,Statement.execute(sql)andResultSet.getObject. "Silent" means a wrong value or wrong rows without an error. Tests are per backend (client/jdbc).type-name-nullableSELECT CAST((1, 'a') AS Nullable(Tuple(UInt8, String)))(alsoNullable(QBit(...)),Nullable(JSON(...)))Nullable(Tuple(UInt8, String)Nullable(Tuple(UInt8, String))type-empty-tupleSELECT tuple()()jdbc-time-as-sql-timeSELECT toTime64('10:10:10.111', 3),SELECT toTime('-01:02:03')10:10:10,22:57:57(java.sql.Time)10:10:10.111,-01:02:03jdbc-use-databaseUSE DATABASE db1, thenSELECT currentDatabase()defaultdb1jdbc-interval-getobjectSELECT INTERVAL 3 DAYP3Dtype-aggregate-functionSELECT uniqState(1);SELECT sumState(toUInt64(1)), 7jdbc-year-zeroSELECT makeDate32(0, 1, 2),SELECT makeDate32(1582, 10, 10)0001-01-02,1582-10-200000-01-02,1582-10-10time64-negative-fractionjdbc-time-as-sql-time)SELECT toTime64('-00:00:01.5', 3)-00:00:00.500-00:00:01.500string-invalid-utf8SELECT unhex('FF')FFjdbc-array-in-variantSELECT [[1, 2]::Variant(Array(UInt8), String), 'a']format-clause-ignoredSELECT 1 AS x FORMAT Nulltype-json-shared-pathSELECT CAST('{"a":1}' AS JSON(SHARED a UInt64)){"a":1}map-duplicate-keysSELECT map(1, 'a', 1, 'b'){1=b}query-text-not-utf8jdbc-duplicate-column-nameSELECT *, 'redefined' AS my_field FROM VALUES('my_field String', 'orig')redefined redefinedorig redefinedtype-enum-backslashSELECT CAST('a' AS Enum8('a' = 1, 'b\\' = 2))NumberFormatExceptionahttp-compress-memorymax_memory_usage = 9830400(01017)MEMORY_LIMIT_EXCEEDED(the response compression counts toward the query memory)http-exception-in-streamCode: 160 (TOO_SLOW)json-decodeSELECT materialize('{"a" : [[1, {}], null]}')::JSONjson-as-string-settingSET output_format_binary_write_json_as_string = 1, thenSELECT '{"a":1}'::JSON, 7format-header-caseSET compatibility = '23.3', thenSELECT 1 FORMAT NULLX-ClickHouse-Formatis parsed case-sensitively)variant-member-orderSELECT CAST('s' AS Variant(LowCardinality(String), Map(String, String))), 'x's,xjdbc-kill-no-resultsetKILL MUTATION WHERE ...jdbc-array-of-geoSELECT [[(1, 2)]::Ring](alsoArray(Geometry))NullPointerExceptionjdbc-set-roleSET ROLE ALL, thenSELECT 2UNKNOWN_ROLEfor a role namedALL(alsoDEFAULT)2Found by small programs (no upstream test shows them, so they are not in the allowlist):
dt64-rangeINSERT INTO t VALUES (?)intoDateTime64(3, 'UTC')withsetObject(1, LocalDateTime.parse("1600-06-01T12:34:56.789"))(alsoInstant,ZonedDateTime,OffsetDateTime,setTimestamp; any precision, outside 1677-09-21 .. 2262-04-11)1677-09-21 00:12:43.9351600-06-01 12:34:56.789dt64-write-overflowclient.register,client.insert) ofLocalDateTime.parse("2263-01-01T00:00")intoDateTime64(9, 'UTC')1678-06-12 00:25:26.290448384DECIMAL_OVERFLOW)jdbc-date-julian-writesetDate(1, Date.valueOf("1000-01-01"))intoDate321000-01-061000-01-01binary-encoded-typesSET output_format_binary_encode_types_in_binary_format = 1, thenSELECT 11type-array-of-pointSELECT [CAST((1, 2) AS Point)]reader-eof-first-columnEOFExceptioninside the first column of a row (AbstractBinaryFormatReader.readRecord)type-aggregate-function,type-json-shared-pathandvariant-member-ordersilenthttp-error-text-lost<Unreadable error message> (transport error: 403)The Go bug classes of the tracking issue were checked on purpose on both backends; the others do not occur in clickhouse-java:
Nullablewith a null-map byte other than 1, NULL inLowCardinality(Nullable)in a named tuple, extremes as data rows, a second connection that loses the session, anINSERTwithout data that hangs, tuples in tuples,Int128in a tuple, quoted tuple element names,Mapkeys of typeArray/Map/Tuple,QBit,session_timezone, and the client's own server-info query in the user's session.Time64precision onclientis correct; onjdbcit isjdbc-time-as-sql-time.Shim gaps (groups marked
shim)shim-output-formatTabSeparatedfamily andNullshim-render-jsonHashMapof paths without order or types, so the shim cannot render it as the server doesshim-render-dynamicDynamicvalue has no typeshim-kql-splitshim-output-settingshim-client-parse-errorSYNTAX_ERRORof the server is taken as a parse error ofclickhouse-clientRun locally
Details (shards,
KNOWN_FAILURES=<id>, the real-client run, how to grow the allowlist):tests/clickhouse-client/README.md.Checklist
FORMAT TSV, both backends) were added; 266 tests pass inscripts/build.sh.🤖 Generated with Claude Code
Note
Low Risk
Test harness and new CI workflow only; no production client or JDBC module changes.
Overview
Adds nightly CI (
.github/workflows/upstream-sql-tests.yml) that builds thetests/clickhouse-clientshim from repo source, starts a pinned ClickHouse server (26.10.4.207), fetches matching upstreamtests/queries/0_stateless, and runs the allowlisted suite throughclient-v2andjdbc-v2in parallel 8×2 shards.The harness is expanded from a simple CLI into a
clickhouse-clientshim: statement splitting, test hints, error-code table generation, TabSeparated rendering from decoded values (not pass-through TSV), plus scripts for build, fetch-upstream, run-upstream-tests, and run-with-real-client triage.allowlist.txtrecords ~10k passing tests and grouped known failures; docs (README.md,AGENTS.md) define triage rules and allowlist growth.No clickhouse-java library code changes—only the test harness, generated
error-codes.tsv, and the new workflow.Reviewed by Cursor Bugbot for commit a34340f. Bugbot is set up for automated code reviews on this repo. Configure here.