Repository navigation
Add test: Untested: key analysis declining a text constant it cannot convert - #121199
Conversation
Pre-PR validation: 6/6 ✅a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
I looked at this because it covers a branch from my #120114. The gap is real. With an The test runs clean and does not depend on settings randomization. 30 runs of it plus 30 of 05214 in one runner invocation against master The oracle does not pin the branch it covers, though. Three measurements in one worktree:
The reason: both conversions inside key analysis parse with default That does not make the test worthless: it is the only test that executes the line, it pins the user-visible invariant (a literal key analysis cannot convert must not prune rows), and it carries a positive control. No objection to it going in as a coverage test. Please fix "This test drives the failure branch of both call sites": it reaches that branch, it does not detect its removal, and as written the next reader will believe the line is behaviourally covered. One thing I noticed while measuring and am not raising: the comparison casts text with
|
|
Workflow [PR], commit [838e5d7] Summary: ✅ AI ReviewSummaryThis is a test-only PR that adds Final Verdict✅ No new findings. |
|
Fixed the description — the branch-coverage claim is gone. The "Unique vs PR tests" line now says the test is the only one that executes that branch (6 hits, both call sites) but does not detect its removal: byte-identical output with Citations corrected to master the latest commit: helper at Your mechanism holds on re-read: the fallback Test file unchanged: its header states only the invariant it asserts, no coverage claim. Understood on the label. |
|
CI failure in |
|
Yes, merging master is the right move. All three red stateless jobs on It was fixed by #121163, merged 2026-09-20T17:25:51Z as |
|
Pushed |
The Condition/Granules assertions read legacy plan output; without the pin they follow the ambient explain_query_plan_default (now 'pretty') or compatibility. Matches 05214_key_analysis_zoneless_datetime_session_tz. Requested by @clickhouse-gh[bot] in ClickHouse#121199 (comment)
Test-only PR. Review: are the gaps real, is the test right.
Adds test coverage for 1 untested code path, found during automated review of PR #120114.
That PR: Fixes rows silently dropped by pruning when a text constant is compared with a
DateTime/DateTime64key whose type name carries no time zone. (1) AddstryNormalizeTextConstantForZonelessDateTimeInputinKeyCondition.cppand calls it fromcanConstantBeWrappedByMonotonicFunctionsand …1. Untested: key analysis declining a text constant it cannot convert
src/Storages/MergeTree/KeyCondition.cpp:2005-2006(the branch),:2124and:2662(the call sites), at master827b4f0e149c6Risk:
KeyCondition::extractAtomFromTree->canConstantBeWrappedByMonotonicFunctions(KeyCondition.cpp:2124) and, forequals/notEquals,canConstantBeWrappedByDeterministicFunctions(KeyCondition.cpp:2662) both call the new helper first; on conversion failure it …Unique vs PR tests: 05214 and 05213 only use literals the helper converts successfully - every arm asserts that pruning happens on the corrected instant. Neither reaches the
converted.isNull()branch, which is the one the CI LLVM report marks uncovered. This test is the only one that executes that branch (6 hits, from both call sites), but it does not detect its removal: withreturn falseat:2006flipped toreturn true, or with the wholeKeyCondition.cppdiff of #120114 reverted, its 12 output lines stay byte-identical (measured by @groeneai in review). The reason is the fallback below the helper:castColumnAccurateOrNull(KeyCondition.cpp:1797) builds its cast with a null context (castColumn.cpp:33), so it never seescast_string_to_date_time_modeand returns NULL for the same literal — the atom is rejected either way. What the test pins is the user-visible invariant: a literal key analysis cannot convert must not prune rows. The third arm is a positive control that pruning is still active (1/2 granules), not a detector of the #120114 fix.Try it on ClickHouse Fiddle
cc @groeneai (author of #120114), @alexey-milovidov (merged/approved #120114) — could you take a look, and add the
can be testedlabel if this looks good?Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — test-only change.
Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/121199]
Version info
26.10.1.810-master(included in26.10and later)