Repository navigation
[tests] Core SQL test harness: write wrapped top-level strings raw in the Raw formats - #3494
Open
polyglotAI-bot wants to merge 1 commit into
Open
polyglotAI-bot wants to merge 1 commit into
polyglotAI-bot wants to merge 1 commit into
Conversation
… the Raw formats In the TSVRaw formats, the shim wrote a top-level string with escapes when its column type was SimpleAggregateFunction(f, <string type>) (both backends), Nullable(Enum8/16) (client backend) or Variant(<string type>, ...) (both backends). The server writes these values without escapes. render() took the raw path only when a type check said "string". The check unwrapped Nullable and LowCardinality, but not SimpleAggregateFunction or Variant, and gave the wrapper type to stringBytes(), so the Enum check did not see Enum8 in Nullable(Enum8). renderValue() now gets the raw flag and passes it through Nullable, LowCardinality, SimpleAggregateFunction and Variant. The String, FixedString and Enum case writes the bytes without escapes when the value is raw and not nested. Values in Array, Tuple and Map stay escaped and quoted. The non-Raw formats do not change. Fixes: #3490 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on f936953. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3490.
In the
TSVRawformats (TSVRaw,TabSeparatedRaw,TSVRawWithNames,TabSeparatedRawWithNamesAndTypes), the shim wrote some top-level strings with escapes. The server writes them without escapes (TabSeparatedRaw: "rows are written without escaping"):SimpleAggregateFunction(f, T)withT=String,FixedString,Nullable(String),LowCardinality(String)orEnum: both backends.Nullable(Enum8)andNullable(Enum16): theclientbackend.Variant(...)with aStringorFixedStringmember: both backends. This case is not in the issue; I found it when I checked the other wrapper types against the server.Cause:
TsvRenderer.render()took the raw path only whenisStringType(type)was true.isStringTypeunwrappedNullableandLowCardinality, but notSimpleAggregateFunctionorVariant. The raw path also gave the wrapper type tostringBytes(), so its Enum check did not seeEnum8inNullable(Enum8). The value then went torenderValue(), which escapes.Fix:
renderValue()gets the raw flag and passes it throughNullable,LowCardinality,SimpleAggregateFunctionandVariant, the types whose text is the text of their inner type. TheString/FixedString/Enumcase writes the bytes without escapes when the value is raw and not nested.isStringType()is removed, so the raw path has no second list of unwrap rules. Values inArray,TupleandMapstay escaped and quoted. The non-Raw formats do not change (rawis false on that path). HarnessAGENTS.md, rule 3: the read methods do not change.Docs and other clients: nothing documented fits (no setting changes Raw escaping); the TabSeparatedRaw page only defines the expected output, and the server confirms it. The clickhouse-cs shim unwraps
SimpleAggregateFunctionin its raw path (ValueRenderer.TryRenderRaw); the clickhouse-go shim has the sameisStringTypecheck as this shim had.Changes
TsvRenderer: the raw flag goes throughrenderValue()andrenderVariant();isStringType()removed.TsvRendererTest: a@DataProviderthat checks theTSVRawand theTSVtext of each value: the wrapper types of the issue andVariant, the Enum label asEnumValue(client) and asString(jdbc), and contrast rows that must not change (non-stringVariantandSimpleAggregateFunctionvalues,NULL, values inArray,Tuple,Map).LiveTest: new expressions on both backends, compared with the server: the four Raw formats with the wrapper types,NULLvalues, values in containers, and the same values inTSV.No
CHANGELOG.mdentry: test harness only, no change to a client. NoREADME.mdchange: no flag, format or setting of the shim changes (harnessAGENTS.md, rule 8).Merge note: #3491 changes the first lines of
render()too, so the PR merged second gets a small conflict there. The resolution keeps the FixedString padding block of #3491, then callsrenderValue(out, type, value, false, raw). Onmain,Build the shimfails onejdbclive test (toFixedString('ab', 4), #3488) until #3491 merges.Test
Server 26.10.4.207 (stock image, the version in
clickhouse-version),CLICKHOUSE_CLIENT_CLI_LIVE=1 scripts/build.sh:-j 6): the 76 allowlisted ones pass; the 8 known failures of the allowlist still fail, for their own groups.Checklist
🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to the Java SQL test harness TSV renderer and its tests; production ClickHouse clients are untouched.
Overview
Fixes the clickhouse-client CLI test harness so TSVRaw output matches ClickHouse: top-level string-like values inside
SimpleAggregateFunction,Nullable/LowCardinality,Variant, and Enum columns are written without tab/newline/backslash escaping whenrawis true.TsvRendererno longer uses a separateisStringType()fast path inrender(). Therawflag is threaded throughrenderValue()(includingSimpleAggregateFunctionandVariantunwrapping) and applied only for non-nested String / FixedString / Enum cells; values inside Array, Tuple, and Map stay escaped. Standard TSV behavior is unchanged (rawfalse).Tests: expanded
TsvRendererTestwith a data-driventestRenderRawWrappedmatrix and newLiveTestqueries across Raw format variants and container contrast cases, compared against server 26.10.Reviewed by Cursor Bugbot for commit f936953. Bugbot is set up for automated code reviews on this repo. Configure here.