fix(types): preserve JSON paths starting with setting names - #498
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a JSON type-hint parsing bug in JsonType where typed JSON paths whose names start with max_dynamic_paths / max_dynamic_types were incorrectly treated as JSON settings and therefore ignored, causing values to be decoded as dynamic instead of using the intended hinted type. It also adds real-server test coverage and documents the fix in release notes and the changelog.
Changes:
- Tightened JSON “setting” detection to only treat
max_dynamic_paths/max_dynamic_typesas settings when they use assignment syntax (...=...), while keepingSKIPhandling intact. - Added real-server tests covering typed paths that start with or equal the affected setting names, plus spaced assignment parsing (
max_dynamic_paths = 10). - Documented the bug fix in both
CHANGELOG.mdandRELEASENOTES.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ClickHouse.Driver/Types/JsonType.cs | Adjusts filtering logic so typed-path hints aren’t dropped when their names start with JSON setting names. |
| ClickHouse.Driver.Tests/Types/JsonTypeTests.cs | Adds real-server coverage for affected path names and spaced assignment settings syntax. |
| CHANGELOG.md | Adds a user-facing bug-fix entry for the JSON typed-path parsing correction. |
| RELEASENOTES.md | Adds a release-notes bug-fix entry describing the JSON typed-path parsing correction. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hi, thanks for this. Looks good, just one small thing with the tests: let's add some cases with a variety of spaces around the assignment, eg something along the lines of: |
5cfe1dd to
146f9c2
Compare
|
LGTM, thank you for your contribution! |
main added 22 new Unreleased entries since this branch was cut. Each is now its own changelog.d/ fragment, extracted verbatim by line number rather than retyped, so the assembled Unreleased section reproduces main's exactly (as a set of lines; sorting by PR number reorders entries within their sections). New fragments, one per (PR, category): #390 improvements multidim blittable inserts #472 improvements per-scalar Span<byte> reads #484 fixes byte[]/TimeOnly HTTP parameters #485 fixes JSON strings under ReadStringsAsByteArrays #490 breaking raw results return compressed bytes #490 features AcceptEncoding response compression #490 improvements lz4 by default, HttpClient, errors, deflate #492 fixes HTTP response disposal #493 fixes Enum type declarations #494 fixes raw-stream double dispose #497 fixes GetSchema("Columns") restrictions #498 fixes JSON paths starting with setting names #503 fixes quoted JSON typed paths #504 fixes quoted Tuple/Nested element names #509 fixes {name:Type} scanner vs server lexer #511 fixes {name:Type} hints after a non-hint brace #513 fixes @name placeholders, heredocs, $ in names #390's entry was appended to the *released* v1.3.0 section on main (v1.3.0 shipped 2026-06-29), so it would have documented an unreleased change under a shipped version and never appeared in 1.4.0's notes. It moves to Unreleased as a fragment; the rest of v1.3.0 is byte-identical. RELEASENOTES.md regenerated with --sync-notes. `--check` passes, the solution builds, and the packed .nupkg's releaseNotes open on v1.3.0 with no Unreleased stub and no #390 bullet.
Summary
JSON type parsing filtered
max_dynamic_pathsandmax_dynamic_typesusing prefix matching. This caused valid typed paths such asmax_dynamic_paths_used UInt64to be discarded as settings.Recognize these entries as settings only when followed by an assignment, while leaving
SKIPhandling unchanged.Tests
dotnet test ClickHouse.Driver.Tests --framework net10.0 --property WarningLevel=0 --filter "Name~ShouldSelectDataWithComplexHintedJsonType|Name~PathStartingWithMaxDynamic|Name~PathNamedMaxDynamicPaths"dotnet build ClickHouse.Driver.sln --framework net10.0 --property WarningLevel=0Checklist