Repository navigation
Fix JSONAllValues text index probe coercion - #113376
rorylshanks wants to merge 44 commits into
Conversation
Coerce constants to the JSON subcolumn expression type before serializing text index probes. Keep identity and `String` casts accelerated, and decline value-changing casts whose stored representation cannot be inferred safely.
|
Workflow [PR], commit [6bc9c6c] Summary: ✅
AI ReviewSummaryThis PR narrows Findings❌ Blockers
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit 6bc9c6c.
Changed lines: Changed C/C++ lines covered: 122/132 (92.42%) · Uncovered code |
Keep typed-path defaults indexed because `JSONAllValues` materializes them, add `String`-cast default coverage, and avoid plan expectations for declined non-identity casts. Related: ClickHouse#113376
Remove unsupported `Array(String)` cast cases instead of bypassing `EXPLAIN`. Related: ClickHouse#113376
|
Hey @CurtizJ it looks like this one has been applied with a "manual approve" label. Is it because I modified an older test? |
I think it's a bug. |
Propagate source types through `Tuple` and `Map` constants so nested values are serialized with the stored JSON types. Cover direct and array composite comparisons. Related: ClickHouse#113376
Compare the dynamic `data.id` string path with a string literal so the query remains valid while preserving the optimizer assertion. Related: ClickHouse#113376
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113376&sha=88db1c523513454f8c1f0ff450ebccbc44e34b58&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. |
Populate the new typed composite paths in every granule so their defaults do not add unrelated tokens to existing pruning assertions. Related: ClickHouse#113376
|
The job you linked failed on That test is mine (shipped by 112273). The failure is a wall-clock promptness overshoot on the assertions 112823 kept: The job's own diagnostics re-ran it and reported The other four Stateless failures on that same head are a different test, and those do come from your diff. Commit 88db1c5 replaced master's Your newest commit 234c70e already changes both occurrences to |
Allow `JSONAllValues` Bloom-filter conditions to evaluate supported predicates on an explicit `String` cast while keeping direct `Dynamic` and `Variant` comparisons disabled. Declared JSON defaults are already emitted by `JSONAllValues`, so keep those concrete typed predicates indexable and only guard missing `Dynamic` and `Variant` string defaults. Related: ClickHouse#113022 Related: ClickHouse#113376
Keep JSON `IN` handling on scalar paths instead of extending the existing tuple set mapping. Collapse the unused direct and identity-cast states and centralize value conversion and serialization. Remove duplicate assertions and use timezone-independent `Dynamic` values for the explicit `String` predicate coverage. Related: ClickHouse#113022 Related: ClickHouse#113376
Decline the index when the comparison value type differs from the JSON subcolumn type instead of recursively coercing constants. Keep focused coverage and preserve the existing query cases. Related: ClickHouse#113376
The safer type handling intentionally declines the index for this array equality predicate. Remove plan lines that four CI variants no longer emit. CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113376&sha=8dc2cdc0178e3ba2fa9941aa01f05c1d35fac30b&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 Related: ClickHouse#113376
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes3 object files changed (+29.98 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units7 translation units recompiled, 17 s compile time in total, 7 of them have a recent master baseline. |
`Time64` text serialization is independent of session time zones and format settings. Allow direct and string-cast probes to retain text-index pruning, with focused coverage.
|
Closing the loop on my earlier comment here. I said I would post the fixing pull request link for I wrote that test and I agreed with removing it. Its promptness assertions measure the wall-clock latency of an in-loop cancellation checkpoint, and I could not find an oracle for that property which is sound from a stateless test. The details are in #112273 (comment). Nothing is needed on your side. Your current head b13f526 no longer carries the file, and the test has 0 FAIL in 740 CIDB rows since the deletion, so that failure cannot recur on this pull request. |
|
Dear @CurtizJ, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Keep the date/time type headers needed for representation-safe probes and use the current text-index includes and map-shadowing checks. The outstanding review proposes wrapped `Variant` carriers that cannot be constructed: `DataTypeVariant::canBeInsideNullable` returns false, and its inherited `canBeInsideLowCardinality` also returns false. Both proposed JSON table definitions return `ILLEGAL_TYPE_OF_ARGUMENT` before index matching. No unreachable unwrapping path is added. Validation: changed-source compile and C++ style checks. Runtime validation of the merged sources remains with CI. ClickHouse#113376
Reject identity casts to `Variant` in the shared `JSONAllValues` index matcher so pruning cannot suppress predicate type errors. Add a regression for both index-reading modes and preserve explicit `String` cast acceleration. Related: ClickHouse#113376 (comment) Related: ClickHouse#113376
|
Closing this. Each edge case I fixed exposed another representation mismatch, and the guard kept narrowing the index. Comparing the literal's text against value tokens can't be made exact once types coerce. The simple and safe fix for #119593 is to decline the index for =/IN on Dynamic paths, like minmax and bloom_filter do. I'd rather put effort into indexes that store the type (#114613, #113022). |
Related: #113022
Fix incorrect result filtering when a
JSONAllValuestext index serializes a comparison constant using a representation that differs from the JSON subcolumn. This includes value-changing coercions such asIPv4toUInt32, types such asBoolwhose semantic equality does not imply identical text, andDateTimerepresentations that depend on time zones.Equality and
haspredicates now use the index only when the probe representation is compatible with the statically typed JSON subcolumn or array element type. Equality andINpredicates on runtime-typed paths, casts fromDynamicpaths, and values with session-dependent serialization are evaluated without this index.Safe direct access and identity casts remain accelerated. Casts to
Stringremain accelerated for statically typed values with stable serialization. Other value-changing casts decline index use because their stored representation cannot be inferred safely.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix incorrect results from
JSONAllValuestext indexes when comparison values require type coercion or have session-dependent or runtime types.Workflow [PR]
Sync PR [sync-upstream/pr/113376]