Skip to content

Fix sporadic Values-template failure with synthesized literals - #110637

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-values-template-synthesized-literal-stale-token
Aug 9, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-values-template-synthesized-literal-stale-token

Conversation

@groeneai

@groeneai groeneai commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix a sporadic Cannot parse string ... as UInt64 ... While executing ValuesBlockInputFormat error that could occur when inserting values whose expressions contain a numeric cast such as initializeAggregation('sumState', 0::UInt64).

Description

Closes: #111970
Related: #109368

Found while investigating the sporadic failure of 03443_projection_sparse reported on #109368 (CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109368&sha=ea8c0f26f97b5a838442598c846acce74e9b3993&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29). The same signature also hit several unrelated PRs, most recently #111589 on 2026-07-26, which is where the tracking issue #111970 comes from.

Failing query: INSERT INTO t_projection_sparse VALUES ('bb', initializeAggregation('sumState', 0::UInt64)), error Cannot parse string 'sumState' as UInt64.

Root cause: the literal token map used by ConstantExpressionTemplate (added in #93974 when begin/end were removed from ASTLiteral) is keyed by raw ASTLiteral * pointers, and entries of literals discarded during parser backtracking are never removed. Some parsers synthesize a literal that survives into the AST but is never tokenized, so it has no entry of its own, yet the allocator can hand it a freed address whose stale entry is still in the map. In the failing case the discarded 'sumState' string-literal probe, tried by ParserCastOperator before it sees there is no ::, left the entry that the synthesized 0 cast value then reused. ConstantExpressionTemplate read the stale span, positioned the placeholder over the 'sumState' text, and a later row fed 'sumState' into a UInt64 placeholder.

Fix: enforce the invariant on the object instead of at each synthesis site. ASTLiteral gets a has_token_info bit that is set only in recordLiteralTokens, the single place a literal is tokenized from the query text, and both consumers of the map (ConstantExpressionTemplate and the LIKE/REGEXP highlighting) ignore a literal whose bit is unset. Address reuse is then harmless for every synthesized literal, including the Tuple/Array slow-path nodes and the numeric operands EXTRACT injects into plus/minus/intDiv chains, several of which are built with no access to Expected.

The failure is an allocator address-reuse race, so a deterministic SQL reproducer is not possible; a unit test asserts the invariant for the tokenized and the synthesized shapes.

Version info

  • Merged into: 26.8.1.1048 (included in 26.8 and later)

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? No deterministic SQL repro possible: it is an allocator address-reuse race (CI's own diagnosis reran it 181x same settings, all passed; ASan never hits it due to allocator quarantine). Mechanism is proven from the CI template dump initializeAggregation('sumState', CAST(-dummy-0, 'UInt64')) where the -dummy-0 numeric placeholder holds 'sumState'.
b Root cause explained? The literal token map (added when begin/end were removed from ASTLiteral) is keyed by raw ASTLiteral*. ParserCastOperator synthesizes the 0 in 0::UInt64 as a literal that survives into the AST but is never tokenized; it carries no map entry of its own, but reuses a freed address whose stale entry (from the discarded 'sumState' string-literal probe) still exists. ConstantExpressionTemplate::extractLiteralTokensImpl then finds the stale span and templates the placeholder at the 'sumState' position, so a later row feeds 'sumState' into the UInt64 placeholder.
c Fix matches root cause? Yes. Erases the token-map entry at the address of the synthesized literal, so it is treated as a fixed constant, exactly restoring the pre-refactor invariant (token info used to live on the ASTLiteral object and die with it). Not a symptom guard.
d Test intent preserved / new tests added? Added src/Parsers/tests/gtest_literal_token_map.cpp asserting synthesized cast/globalVariable literals carry no token-map entry. No existing test weakened.
e Both directions demonstrated? Fix build passes the exact scenario 1000x (0 failures), 03443_projection_sparse + 00948/03369/04267 values-template tests pass, behavior preserved for varying numeric/string casts and @@. The race itself cannot be made to fail on demand locally (see (a)); the unit test verifies the invariant the fix guarantees.
f Fix is general across code paths? Yes. Applied at both sites that synthesize a surviving literal in a templatable position: ParserCastOperator (numeric branch, the proven signature) and ParserGlobalVariable (@@name). tupleElement arg1 is always-constant (not visited by the template extractor) so not vulnerable; viewExplain is subquery-only, not VALUES.
g Fix generalizes across inputs? The invariant (a synthesized, non-tokenized literal must not inherit a stale span) holds for any value/type of the cast literal. Verified numeric casts of UInt64/Int64/Float64 and string casts still template/parse correctly.
h Backward compatible? Yes. Pure parser-internal fix; no setting, format, or on-disk change. Restores pre-refactor behavior.
i Invariants and contracts preserved? Yes. The token map's contract is "an entry describes the token span of the literal currently at that address"; a synthesized literal that was never tokenized has no valid span, so removing any stale entry upholds the contract. No other invariant touched.

Session id: cron:clickhouse-worker-slot-3:20260716-033400

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @Avogar for review. Parser/Values-format fix: a literal synthesized by ParserCastOperator (and ParserGlobalVariable) could inherit a stale entry in the raw-pointer-keyed literal token map via allocator address reuse, making ConstantExpressionTemplate template it against a wrong position. This is the root cause of the sporadic 03443_projection_sparse Cannot parse string 'sumState' as UInt64 failure.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1a9b25f]

Summary: ✅


AI Review

Summary

This PR fixes the stale-address LiteralTokenMap hazard by moving token-span validity onto ASTLiteral and making both consumers ignore synthetic literals that were never tokenized from the query text. I reviewed the current diff, the prior discussion, and the updated tests, including the dedicated regression that drives ConstantExpressionTemplate directly, and I did not find remaining correctness, compatibility, or coverage issues in the submitted patch.

Final Verdict

✅ No new review findings.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.60% 86.60% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.90% 78.80% -0.10%

Changed lines: Changed C/C++ lines covered: 198/203 (97.54%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 16, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — a5aa67b

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Integration tests (amd_tsan, 3/6) / test_replicated_database::test_replicated_table_structure_alter flaky (326 unrelated PRs, 64 master / 30d) #110030 (ours, open)

Session id: cron:our-pr-ci-monitor:20260716-110000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Good catch — widened to enforce the invariant centrally rather than erasing at each synthesis site.

Root of the hazard: the token map is keyed by raw ASTLiteral*, and the allocator can hand a freed, previously recorded address to a newly synthesized literal. The two eraseLiteralTokens calls only covered the two ExpressionElementParsers sites; the Tuple/Array slow-path literals (ExpressionListParsers.cpp getResultImpl) and the EXTRACT plus/minus/intDiv operands (buildExtractTimePartAST) are built in getResultImpl / free functions that have no access to Expected, so per-site erasure isn't even reachable there without threading the map through 18 getResultImpl overrides.

Instead the validity now lives on the object:

  • Added a has_token_info bit to ASTLiteral (reuses the existing flags storage, no size cost).
  • Set it in exactly one place — recordLiteralTokens, the only site that tokenizes a literal from the query text.
  • Both map consumers (ConstantExpressionTemplate::extractLiteralTokensImpl and the LIKE/REGEXP highlightRegexps) now ignore any literal with the bit unset.

Any parser-synthesized literal (Tuple/Array slow path, EXTRACT injects, casts, global vars, dateDiff unit, etc.) has the bit unset, so address reuse is harmless regardless of how it's constructed. Removed the now-unnecessary eraseLiteralTokens helper and its two call sites.

Test: extended gtest_literal_token_map to assert the invariant (flagged ⟹ in map) and to cover the numeric-cast, global-variable, slow-path Tuple, Array, EXTRACT-injected, and a positive tokenized-literal shape. All pass.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — b6b50c6

Every failure below has an owner (a fixing PR). None is PR-caused (this PR only touches the Values-template literal-token parser path).

Check / test Reason Owner / fixing PR
Stress test (amd_debug) — Received signal 8 (SIGFPE) crash: div-by-zero in EnabledQuota::Interval::getEndOfInterval (EnabledQuota.cpp:237) on a zero-length quota interval, hit during auth (AccessControl::authenticate). Unrelated to this PR. #110346 (ours, open)
Stateless (amd_llvm_coverage, old analyzer, s3, DBReplicated, WasmEdge, parallel, 2/3) — server died (12 tests + "Unknown error") crash: coverage abort-on-logical-error SIGABRT in FunctionBinaryArithmetic<MultiplyImpl>::executeImpl2 on SELECT n * 0.123 (Int256 vs Float64), issue #110133 EXCHANGE-TABLES-vs-SELECT race. All 12 tests are crash victims of the single server death, not independent failures. #109747 (ours, open) / #110048 (external, open)

Session id: cron:our-pr-ci-monitor:20260716-173000

@groeneai

groeneai commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Merged master (the branch was 7788 commits behind) and addressed what the merge turned up.

Two conflicts, both where master has since reworked this area:

  • ConstantExpressionTemplate.cpp: master's LiteralTokenMap::find returns a pointer now
    rather than an iterator (3a7b0a7). Took master's call shape, kept the hasTokenInfo
    guard ahead of it.
  • gtest_literal_token_map.cpp: add/add. Master grew six tests for the map's own mechanics;
    this branch adds six for the invariant. Kept both - they test different things.

Master also landed LiteralTokenMap::forget (69d2b5b) for the same defect class, and it
is complementary rather than overlapping: forget covers a subtree the parser knowingly
discards, but a parser that synthesizes a literal it KEEPS has no subtree to forget, which is
the cast operator's numeric literal, @@name, the Tuple/Array slow path and the operands
EXTRACT injects. 03443_projection_sparse and master's own new
04654_cast_operator_values_template both pass here.

Three things changed beyond the merge, from reviewing it:

  1. The token-info bit is now cleared in ASTLiteral's copy constructor and copy assignment,
    not just left to ride along. The bit asserts "my own address is recorded in the token map",
    which is false for a copy. Direct copies do exist - ConstantNode::toAST and
    RewriteSumFunctionWithSumAndCountVisitor, the latter copying a literal that came from the
    query text. Not a wrong-results fix: both map readers run on parser-produced nodes against a
    map owned by their caller, and getFromCacheOrConstruct extracts before it clones. Note
    declaring these is not optional once the copy constructor is user-provided - the implicit
    assignment becomes deprecated and this tree is -Werror. No move operations are lost:
    IAST and ASTWithAlias already declare copy operations and no moves.
  2. ArrayLiteralTokenInfoInvariant was passing vacuously - it filtered literals on
    !hasTokenInfo and then asserted !hasTokenInfo on them, which is true of the empty set.
    An array of literals is taken by the fast path, so it now asserts the positive half. I
    checked 12 spellings and none reaches ArrayLayer::getResultImpl with an ASTLiteral(Array);
    the slow-path synthesis is covered by the Tuple test, which does reach it.
  3. Comments trimmed to the local invariant, with the motivation in the commit messages.

Known gap, stated plainly: the tests pin WHICH literals carry the bit - each arm reddens under
mutation - but not that a consumer honours it. Deleting the guard in
extractLiteralTokensImpl leaves them green. Driving ConstantExpressionTemplate from a unit
test needs a Context and the Values plumbing; I tried the highlighting consumer through the real
parser and the test was vacuous, because highlightRegexps reads args->children[1] directly
and every spelling that puts a string literal there is tokenized, while every synthesized path
puts a function there. So that guard is currently unreachable. I removed the vacuous test rather
than keep a green assertion that checks nothing. Happy to drop the highlighting guard if you
would rather not carry an unreachable one.

@clickhouse-gh

clickhouse-gh Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.50% 86.50% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.70% 78.70% +0.00%

Changed lines: Changed C/C++ lines covered: 140/144 (97.22%) · Uncovered code

Full report · Diff report

@groeneai

groeneai commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — e3f65c7

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

174 check-runs, 0 incomplete (paginated check-runs API), Config Workflow and Finish Workflow both green, last completion 23:47:52Z. One failure.

Check / test Reason Owner / fixing PR
Bugfix validation (unit tests) PR-caused: the overlaid src/Parsers/tests/gtest_literal_token_map.cpp cannot COMPILE against the merge base, because 12 of its assertions call hasTokenInfo, which this PR's own non-test diff adds to ASTLiteral. cmake configures fine, so this is not the submodule-drift class PR-caused, to be fixed in this PR

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110637&sha=e3f65c7e4e6fd08b75c153b674da5b9f9de01c31&name_0=PR&name_1=Bugfix%20validation%20%28unit%20tests%29

compile == ERROR is deliberate (ae4864a3575e), and the sanctioned remedy is on the test side while keeping the runtime assertion intact, as in ca63edf26803 (if constexpr (requires { ... }) dispatching on the available signature), 5cc9dc9dd714 and ff6fea4c8bba. I will apply that here so the gtest builds against both trees and still fails at runtime on the before-binary. I am not weakening any assertion.

Session id: cron:our-pr-ci-monitor:20260802-000000

@groeneai

groeneai commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed the Bugfix validation (unit tests) failure on e3f65c7e4e6f, which was caused by this pull request's own test file.

The job builds a "before" binary from the merge base with only the unit-test files overlaid, so the test has to compile without the fix. Twelve assertions called hasTokenInfo, which this pull request adds to ASTLiteral:

ci/tmp/before_src/src/Parsers/tests/gtest_literal_token_map.cpp:186:
  error: no member named 'hasTokenInfo' in 'DB::ASTLiteral'

A compile failure is reported as inconclusive, so the check went red. Report

The test now dispatches on the available API with a requires clause from a template, the way gtest_replicated_metadata_compare.cpp does. The fallback is what the consumers do without the fix: nothing tells a recorded literal from a synthesized one that reused its freed address, so the map lookup is the whole predicate.

The negative cases also no longer wait for the allocator to hand out a freed address, they stage the dead span at the literal's own address, so they hold that state deterministically instead of by chance.

Verified in both directions on the merge base b0e7f23d5a0d, reproducing the job's overlay locally:

tree compile runtime
merge base + this test only succeeds 5 of 13 fail, all 13 reach [ RUN ]
this pull request succeeds 13 of 13 pass

So the job now reaches its reproduction path instead of stopping at the build. Non-vacuity re-checked in both directions: forcing hasTokenInfo to return true reddens all 5 negative cases, and removing the setHasTokenInfo call reddens the 3 positive ones.

The consumer-guard-liveness gap I described earlier is unchanged and still open: these tests pin which literals carry the marker, not that a consumer honours it.

@groeneai

groeneai commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

Correct, and I could not close this before. Now I can, so I did: a4351e7.

The blocker I hit in earlier rounds was that I believed template deduction was
unreachable from a unit test (it seemed to need a Context plus Values plumbing).
That was wrong. ConstantExpressionTemplate::Cache::getFromCacheOrConstruct is public
and takes a ContextPtr, and Common/tests/gtest_global_context.h already gives gtests
one, so the consumer can be driven directly and dumpTemplate read back.

src/Processors/Formats/Impl/tests/gtest_constant_expression_template_token_guard.cpp
does what you described: it stages a stale span on the synthesized literal, then deduces
a template for 1.5::Decimal32(3) and asserts the placeholder does not land on the type
argument.

The mutation you predicted now reddens. Deleting the guard at
ConstantExpressionTemplate.cpp:68-76:

  • new test FAILS: the template renders '1.5', '::', 'Decimal32', '(', String, ')', eof
    instead of '1.5', '::', 'Decimal32', '(', '3', ')', eof, i.e. the placeholder moves
    onto the type argument, which is the defect itself;
  • gtest_literal_token_map.cpp stays 13/13 green, exactly your point.

Non-vacuity in the other direction too: removing the setHasTokenInfo call reddens the
positive control (1 + 2 stops being templated), so the assertion is not a fact about
how the test renders a template.

The stale entry is staged at the literal's own address rather than waited for, so nothing
depends on the allocator handing out a reused address.

The file uses only APIs that predate this change, so it still compiles against the merge
base and fails there at runtime, which is what Bugfix validation (unit tests) needs.
15/15 pass on the fix; 6 fail on the merge base.

@groeneai

groeneai commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - a4351e7

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Fast test / 02280_add_query_level_settings trunk regression in the plain-VALUES insert path, not caused by this pull request a fix task is created (investigating at full effort, fixing-PR link to follow here)

174 check-runs, 0 incomplete, Config Workflow and Finish Workflow both green. That is the only failure.

The test fails on the first INSERT INTO table_for_alter VALUES (1, '1') into an empty table with
Too many parts (1 with average size of 453.00 B) ... (TOO_MANY_PARTS), which is wrong on its face:
the table held zero parts when the query started.

Why it is not caused by this pull request, from the job's own server log
(query 9e72a81f-9efb-4e7c-a470-af59637a0625):

  • one INSERT built 26 MergeTreeSinks, and the part all_1_1_0 was already committed
    (Renaming temporary part tmp_insert_all_1_1_0, at .502582) before the throw (at .509776);
  • the stack pins frame 5 at MergeTreeData.cpp:7041, the
    parts_count_in_partition >= active_parts_to_throw_insert throw, reached through frame 7
    ExceptionKeepingTransform.cpp:122, i.e. the onStart stage. MergeTreeSink::onStart is the
    only onStart passing allow_throw = true (consume already passes false). So the branch
    holding the data commits its part, and a sibling branch's onStart then sees
    1 >= parts_to_throw_insert = 1 and throws.

The write fan-out for plain VALUES inserts is new in master (PR 109000, merged 2026-08-01
20:48Z). This pull request touches only src/Parsers and ConstantExpressionTemplate.cpp, and no
MergeTree, sink or insert-path file. The delta between the head where Fast test passed
(cd7a930cd1aa, 01:12Z) and this head is a single new gtest file, and Fast test configures with
-DENABLE_TESTS=0, so that file is not compiled into the binary under test. The
Too many parts (N with average size form has 3 rows in 14 days of CIDB, all after that merge,
across 3 pull requests and 2 authors.

Session id: cron:clickhouse-maint-slot-12:20260802-031600

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing-PR link for the Fast test / 02280_add_query_level_settings ledger line

The ledger line above promised a fixing-PR link. It exists now:
#113045 (external, open), "Perform the Too many parts check once per INSERT query".

It fixes exactly the mechanism that line named: a plain INSERT ... VALUES writes through up to
max_insert_threads sinks, each of which runs the throwing parts_to_throw_insert check in
onStart, so a sink scheduled late counts a part the query itself has just committed and rejects
the query mid-flight. #113045 makes that check run once per INSERT per destination table
(std::call_once), in both MergeTreeSink::onStart and ReplicatedMergeTreeSink::onStart.

One correction to my earlier ledger text: I called this a regression introduced by the parallel
plain-INSERT pipeline. That attribution was too strong. The sink fan-out has existed on the
INSERT SELECT path since 031a9d5a528; the plain-VALUES change only made the defect reachable
from INSERT ... VALUES, which previously always had a single sink.

This line is now owned by #113045. I am not opening a competing fix.

Session id: cron:clickhouse-plan-slot-0:20260803-060500

@PedroTadim

Copy link
Copy Markdown
Member

@groeneai fix the Fast test failure

`ConstantExpressionTemplate` looks token spans up in `Expected::literal_token_map`,
which is keyed by raw `ASTLiteral *`. Only literals the parser actually tokenized
from the query are recorded there, but the key is a bare pointer: once a recorded
literal is freed, a literal the parser synthesizes later can be allocated at that
same address and silently inherit the dead entry. The consumer then splices a
placeholder over a span of the query that has nothing to do with that literal, so
a type argument or an aggregate-state name is replaced by the placeholder and the
INSERT fails.

That is the sporadic

    Cannot parse string 'sumState' as UInt64: syntax error at begin of string
    ... While executing ValuesBlockInputFormat

failure of `03443_projection_sparse` and friends: the `'0'` literal synthesized by
`ParserCastOperator` for `0::UInt64` in `initializeAggregation('sumState', 0::UInt64)`
inherited the span of the discarded `'sumState'` string-literal probe. It is
sporadic because it needs the allocator to hand back a freed literal's address.

Add a `has_token_info` bit to `ASTLiteral`, set only by `recordLiteralTokens`, and
have the consumers ignore any map entry for a literal that does not carry it. The
bit is cleared on copy and copy-assignment, and therefore on `clone`, since a copy
lives at an address the map knows nothing about.

Keying the guard on the literal itself rather than on call sites covers every
synthesized literal, not just the two `ExpressionElementParsers` ones: the
`Tuple`/`Array` slow path and the numeric operands injected into the
`plus`/`minus`/`intDiv` chains for `EXTRACT(...)` also build final literals without
recording token info, and `highlightRegexps` reads the same map.

Tests: `gtest_literal_token_map` pins which `ASTLiteral` shapes set and clear the
bit; `gtest_constant_expression_template_token_guard` drives real template deduction
through `ConstantExpressionTemplate::Cache::getFromCacheOrConstruct` after staging a
stale span on a synthesized literal, and reddens if the guard is removed.
@groeneai
groeneai force-pushed the fix-values-template-synthesized-literal-stale-token branch from a4351e7 to 1a9b25f Compare August 8, 2026 20:42
@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

@PedroTadim I pushed 1a9b25f: the branch is squashed to one commit and rebased onto
current master, so a fresh CI run now decides this.

On the red you saw: it was Fast test / 02280_add_query_level_settings failing with
Too many parts (1 with average size of 453.00 B) ... (TOO_MANY_PARTS) on
INSERT INTO table_for_alter VALUES (1, '1') into an empty table. That was the only
failure on the old head (174 check-runs, 0 incomplete), and it is not produced by this
change. Two measurements:

  • On this same branch, cd7a930c passed Fast test and a4351e78 failed it, and the
    entire diff between those two heads is one new gtest file. ci/jobs/fast_test.py
    configures with -DENABLE_TESTS=0 and src/Processors/Formats/Impl/CMakeLists.txt
    gates tests/ behind if (ENABLE_TESTS), so that file is not compiled into the
    binary Fast test runs. The parser change was present at the passing head too.
  • Keyed on the signature (TOO_MANY_PARTS plus average size) rather than on a test
    name, CIDB gives 101 rows across 87 distinct pull requests and 4 test names in 14
    days, onset 2026-08-01, including 7 rows with no pull request at all (plain master
    and merge-queue runs). For 02280 in Fast test over 30 days it is 9 failures
    against 14911 passes.

The owner is #113045, "Perform the Too many parts check once per INSERT query", which
is still open, so there was nothing merged for me to pick up. I had posted that link
here on 2026-08-03.

What I did instead of treating a 0.06% trunk flake as a code fix: the head was 3005
commits behind master and carried 14 commits. It is now one commit on top of
fbb21f1a, with the same content as before (identical patch id across the squash and
the rebase). I rebuilt unit_tests_dbms against merged master and re-verified both
directions: 15/15 pass with the guard, and deleting the hasTokenInfo check makes
ConstantExpressionTemplateTokenGuard.SynthesizedCastLiteralIsNotTemplated fail while
the positive-control case still passes.

This pull request has had no human review since 2026-07-16, and it is what stops the
Cannot parse string '<agg>State' as UInt64 ... While executing ValuesBlockInputFormat
family, which surfaced again on unrelated pull requests as recently as today. A review
would be welcome.

@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 1a9b25f

CI is fully finished on this head and there are no failing checks.

Check / test Reason Owner / fixing PR
(none) - -
CH Inc sync private sync (pending) CH Inc sync (private, not actionable by me)

Session id: cron:our-pr-ci-monitor:20260809-013000

@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 9, 2026
Merged via the queue into ClickHouse:master with commit 2b57762 Aug 9, 2026
180 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: 03443_projection_sparse

4 participants