Repository navigation
Do not name a CI failure after a failure message quoted in a multi-line query - #121339
Conversation
…ne query `Upgrade check (amd_release)` reported ``Assertion `parameters == nested_func->getParameters()' failed`` on a PR whose diff touches no aggregate function code. Nothing asserted. The name came from line 8 of tests/queries/0_stateless/04057_aggregate_function_nothing_with_parameters.sql, a comment documenting the symptom of the already fixed ClickHouse#100584, which `executeQuery` echoed back as query text when the stress phase injected a memory limit fault. `find_failure` already skips a failure pattern matching inside a quoted query, added in c4cc3b6, but the test is line local: it looks for `(in query:` in the part of the *same* line before the match. `toOneLineQuery` collapses a query to one line except that it deliberately re-emits a newline after every SQL comment (src/Parsers/toOneLineQuery.cpp), so a statement with N leading comments is logged as an N+1 line message and only its first line carries the marker. A match on line 2..N is not skipped. The cost is not only a wrong name. `find_failure` returns the first unguarded candidate and `failure_candidates` caps the scan at 50, so a real failure logged later in the same log is never reached. In the artifact above the quote is at line 134,699 and the log's only real <Fatal> record is at line 900,288, which the quote hid. That is the failure mode c4cc3b6's own message records for ClickHouse#115707. So the guard now also asks whether a matched line continues a query quoted earlier in its record, by walking back to the record start. The quoted query is the last field of both message formats in src/Interpreters/executeQuery.cpp, so it ends either at the stack trace marker or at the `)` that closes `(in query:`, whichever is met first while walking back. Every other shape, including an exhausted 100 line lookback, reports "not inside", so this can only ever stop naming a run after a quote, never suppress a real failure. The guard sits in `find_failure`, which all eight ERROR_PATTERNS families are matched through, so no pattern needed to change. Measured on that job's own 900,323 line artifact: before this change `parse_failure` returns "Assertion `parameters == nested_func->getParameters()' failed (STID: None)", byte identical to the CI DB row; after it, the real watchdog record at line 900,288. A second in-tree carrier with the phrase on a comment line, 04210_intdiv_array_nullable.sql, is covered the same way. Five tests are added to ci/tests/test_log_parser.py, each pinned in both directions. Making the guard decline to fire reddens all five; dropping either terminator reddens one each, and dropping the record start gate reddens one, so no branch of the new code is unpinned and no test passes vacuously. MAX_FAILURE_CANDIDATES = 50 is deliberately left alone: it is a cost bound on an `rg | head` over a possibly multi gigabyte log, and this change reduces how many candidates are quotes in the first place. Failure this fixes, Upgrade check (amd_release): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=121251&sha=05c8bec9562561b4cfd0f63b54ec582884e3c7e1&name_0=PR Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review (click to expand)An independent model reviewed this cold in two rounds; the second re-read both files in full and returned
Two suspicions raised and killed, so nobody re-derives them: that the walk could hide a real |
|
Workflow [PR], commit [c9bdb66] Summary: ✅ AI ReviewSummaryThis PR improves Findings
Final VerdictChanges requested. |
CI finish ledger - 3cae437Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
This PR cannot reach it: the diff is CI Python only ( All 172 check runs completed (36 pass, 133 not selected, 3 red), Session id: cron:our-pr-ci-monitor:20260927-093142 |
…uery `inside_quoted_query` treated any preceding line ending with `)` as the end of the quoted query. Every continuation line of a quoted query exists because `toOneLineQuery` keeps the newline after a `--` comment, so a line such as `-- Selecting subcolumns (e.g. .null, .size0, tuple elements, map keys/values)` (from `04097_buffer_subcolumn_virtual_column_crash.sql`) ends with the comment's `)`, not the query's. Only a `)` on a line without a `--` comment now ends it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…-from-quoted-multiline-query
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121339&sha=3cae43799588f8dc278a5d23f2692760a9d2929b&name_0=PR&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. It looks like #122327 ( |
|
Acknowledged. The duplicate name comes from my #109223 (merged on 09-21): it made the analyzer honor the |
…query lines `inside_quoted_query` kept a quoted query open past any line containing `--`, so `SELECT if(1, '--', 'x'))` did not close it and a real failure logged after it was skipped as quoted text; and `#`, `//` and `/* ...` comment lines ending with `)` still closed it. `ends_in_comment` now scans the query part of the line (after the `(in query:` marker on the record's first line), skipping string literals and quoted identifiers, and reports whether the line ends inside a `--`, `//`, `# `, `#!` or unterminated `/*` comment, like the `Lexer`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`inside_quoted_query` decided line by line whether a `)` ending a line closed the quoted query, so a `/* ... */` comment spanning several lines lost its state and a `)` ending a line inside it was taken as the end of the query. Now the marker line is found first and the query text is scanned forward from it, carrying the (nested, as in `Lexer`) block comment depth from line to line. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ved signal`
The crash record of `SignalHandlers.cpp` is `(query: {}) Received signal {} ({})`
and keeps the query's raw newlines, so for a multi-line query the `)` closing
the quoted query precedes the match in the same line, not at its end. Check the
current line's text before the match too, and treat `) Received signal ` as the
end of the quoted query, so such a crash is named `Segmentation fault` /
`Received signal` instead of falling back to a generic `<Fatal>`.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The analyzer names a matched column whose bare name also binds to another table expression, an alias or an ARRAY JOIN expression with a qualified projection name (`r.a`), and an unprefixed `APPLY f` wraps that name (`toString(r.a)`). ClickHouse#109223 made the analyzer honor the `APPLY` name prefix, but seeded the prefixed name from the short column name, so `l.a` and `r.a` of a join both became `f_a`. Two different columns under one name then collide wherever the name is the key: `SELECT * FROM (...)` over the query reads the first `f_a` twice (wrong result, issue ClickHouse#122327 and the AST fuzzer "Subquery wrap oracle mismatch" on ClickHouse#121339 and in two other PRs), two different constants under one name fail the block structure check with `Code: 352 AMBIGUOUS_COLUMN_NAME`, and `remote()` over such a query fails with `Code: 44`. Seed the prefixed name from the column's projection name instead: `f_r.a`, the same base `*` and `APPLY f` use, and the same base a chained prefix after an unprefixed transformer already had (`q_toString(r.a)`). Names change only where the unprefixed name is already qualified: joins, a SELECT alias equal to a column name, an ARRAY JOIN clash and `tuple.*` (`f_tup.x`); a plain single-table `*` keeps `f_a`. A `REPLACE` result keeps the replaced column's name, so a `REPLACE (untuple(a) AS a)` expansion resets the accumulator to it (`a.1`, not `r.a.1`). The new test covers JOIN USING/ON, two tables, three joins, qualified and tuple matchers, join_use_nulls, a lambda, chained prefixes, named untuple and COLUMNS, with single-table and REPLACE controls. 04401 now expects `f_x.a` for a column qualified by a clashing SELECT alias, like its unprefixed `toString(x.a)`. Closes ClickHouse#122327 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The crash record of `SignalHandlers.cpp` keeps the query's raw newlines, so an earlier line of the query ending with `)` (e.g. `SELECT tuple(1)`) does not close the quote, and the real end of the query may be inside a comment (e.g. `SELECT 1 -- c) Received signal 6`). `quoted_query_ends` now ends the quote of a crash record only at `) Received signal `, so the failure is no longer named after failure text quoted on a later line of the query. Follow-up of ClickHouse#121339 addressing its unresolved review thread. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Related: #111708
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Upgrade check (amd_release)reportedAssertion `parameters == nested_func->getParameters()' failedon an unrelated PR (report).
Nothing asserted. The name is a comment in
04057_aggregate_function_nothing_with_parameters.sqlabout an already fixed issue, echoed back asquery text after the stress phase injected a memory limit fault.
find_failurealready skips such a match (c4cc3b682605d), but only when the marker is on the sameline.
toOneLineQuerydeliberately re-emits a newline after every SQL comment, so a multi-line queryspans several log lines and only the first carries
(in query:.The cost is not just a wrong name:
find_failurereturns the first unguarded candidate, so the quotehides every real failure after it. Here the quote is at line 134,699 and the real
<Fatal>record atline 900,288.
The guard now walks back to the record a match belongs to. The quoted query is the last field of both
executeQuerymessages, so it ends at the stack trace marker or the)closing(in query:; anyother shape, and an exhausted lookback, keeps the match as today.
One shape stays uncovered: a comment line ending in
)reads as the closing one, 3 of the 42 suchlines in
0_stateless(e.g.04097_buffer_subcolumn_virtual_column_crash.sql:2). A stricter testcovers them but then hides a real failure logged bare after such a record. Happy to make that trade
if you prefer.
Validated on that job's 900,323 line artifact: the parser now reports the real record, not the quote.
#111708 touches the same file but is orthogonal (it anchors
Logical errorto a real<Fatal>record).Workflow [PR]
Sync PR [sync-upstream/pr/121339]
Version info
26.10.1.1123-master(included in26.10and later)