Repository navigation
Keep a compound function name parsable when one of its parts contains a dot - #129405
PedroTadim merged 1 commit into
Conversation
… a dot The parser joins the parts of a compound function name with a dot and keeps only the joined string plus the compound flag. A back-quoted part may itself contain dots. Since ClickHouse#128992 the formatter writes a compound name part by part and split the joined name on every dot, so `..` inside a part, or a part that starts or ends with a dot, produced an empty part, written as an empty quoted identifier that ParserIdentifier rejects: SELECT `a..b`.f(1) -> SELECT a.``.b.f(1) The debug-build round trip in executeQuery then throws LOGICAL_ERROR "Inconsistent AST formatting". The AST fuzzer reaches it through `{N..M}` globs turned into quoted identifiers (STID 1941-26fa, 1941-1bfa). The original part boundaries are not recoverable from the joined name, so choose them leftmost-greedy: a dot separates two parts only when the part before it is non-empty and text follows it. Every name the parser produces (at least two non-empty parts) still gets at least two parts with the same joined name, so it parses back as a compound name; Context::executeTableFunction and the EXPLAIN SYNTAX view inlining take a different path for a non-compound name, so writing such a name as one quoted token would change their decision after a round trip. Names without an empty part are written exactly as before. A name with no compound spelling (`v.`, only from AST JSON or the analyzer) is written as one quoted token, as before ClickHouse#128992. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261104-230500 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261104-222900 |
|
cc @PedroTadim @george-larionov, could you review this and add the |
|
Workflow [PR], commit [b47bcd7] Summary: ✅
AI ReviewSummaryPR #129405 fixes Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 9 s compile time in total, 7 of them have a recent master baseline. |
b5f8086
Related: #128992
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
#128992 made
ASTFunctionwrite a compound name (db.pv(...)) part by part, splitting the joined name on every dot. A back-quoted part can contain dots, so..or a part that starts or ends with a dot yields an empty part, written as an empty quoted identifier, which does not parse:SELECT `a..b`.f(1)is formatted asSELECT a.``.b.f(1). The AST fuzzer hits this through{N..M}globs in quoted identifiers, a debug-buildInconsistent AST formattingLOGICAL_ERROR: 1, 2, 3, 4.The AST keeps only the joined name, so the original boundaries are lost. A dot now separates two parts only when the part before it is non-empty and text follows it. Every parsed name still gets at least two parts with the same joined name, so it parses back as a compound name, which
Context::executeTableFunctionand theEXPLAIN SYNTAXview inlining rely on. A name without an empty part is written exactly as before.Not for changelog: #128992 is only in master.
Validation: the new test fails on master and passes with the fix (50/50 randomized runs). The four CI queries abort a master debug build and give ordinary analysis errors with the fix. 810 names built from parts such as
.,..,a.,.a,a..bandselectround-trip and run without the abort; 1176 queries over names without an empty part format byte-identically on both builds.Workflow [PR]
Sync PR [sync-upstream/pr/129405]
Version info
26.11.1.1425-master(included in26.11and later)