Repository navigation
Fix logical error in FillingTransform for INTERPOLATE aliasing a WITH FILL column - #110103
Conversation
… FILL column With the old analyzer (enable_analyzer=0), an INTERPOLATE target that only aliases a WITH FILL column is not materialized as a separate column, so its header position coincides with the fill column position. A generated gap-fill row is then written twice into that position (once by the filling loop, once by the interpolate loop) while other columns get a single insert, producing a chunk with inconsistent row counts and a "Invalid number of rows in Chunk" LOGICAL_ERROR abort at FillingTransform.cpp. Reject this configuration in the FillingTransform constructor with a clear INVALID_WITH_FILL_EXPRESSION exception, mirroring the existing guard for the sorting-prefix-vs-interpolate overlap. Interpolating a column that IS the fill column is meaningless (its value is fully determined by the fill), and the new analyzer already materializes a distinct column so it is unaffected. Found by the AST fuzzer (STID 3366-35de). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-2:20260711-164000 |
|
cc @KochetovNicolai @vdimir — could you review? Small fix in the |
|
Workflow [PR], commit [03a44d3] Summary: ✅
AI ReviewSummaryThis PR adds a constructor-time guard in Final Verdict✅ No blockers or majors found in the current diff. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 8/9 (88.89%) · Uncovered code |
CI finish ledger — 03a44d3Every 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
This PR touches only Session id: cron:our-pr-ci-monitor:20260712-010000 |
There was a problem hiding this comment.
Isn't this a common use case? Does pre-existing logical error always fire? Otherwise, if we break existing working queries, it may not be backward compatible, even though it's only for the old analyzer.
|
@vdimir Good question. I built the matrix on a debug binary (old analyzer,
So the patch does not break any query that returns data today; it only converts an abort-on-any-data (empty-input-only success) into a clear, consistent error. On "common use case": INTERPOLATE on the fill column itself is contradictory. The fill sequence already determines that column's value on generated rows, so interpolating the same column is meaningless. The common, useful case (INTERPOLATE on a non-fill column) is unaffected and still works. This also matches the constructor's pre-existing symmetric guard for the sorting-prefix-vs-INTERPOLATE overlap, which rejects unconditionally too (including empty input). Rejecting the fill-vs-INTERPOLATE overlap the same way keeps the two consistent. Happy to narrow it if you prefer, but given the only preserved-today behavior is an empty-result query that crashes on any data, I think the unconditional reject is the correct fix. New analyzer materializes a distinct column and is unaffected either way. |
2b4ea4c
The repo-wide style rule rejecting the "new analyzer" wording (ClickHouse#110160) and the test 04402_with_fill_interpolate_fill_column_overlap.sql with a "The new analyzer materializes ..." comment (ClickHouse#110103) were merged independently, each with CI that predated the other, so every branch containing both now fails "Style check". Reword the comment to "The analyzer materializes ..." as the rule suggests. This is the only occurrence in the repository. Co-Authored-By: Claude Fable 5 <[email protected]>
…ngtransform-interpolate-staleness-3366-35de Fix logical error in FillingTransform for INTERPOLATE aliasing a WITH FILL column
The repo-wide style rule rejecting the "new analyzer" wording (ClickHouse#110160) and the test 04402_with_fill_interpolate_fill_column_overlap.sql with a "The new analyzer materializes ..." comment (ClickHouse#110103) were merged independently, each with CI that predated the other, so every branch containing both now fails "Style check". Reword the comment to "The analyzer materializes ..." as the rule suggests. This is the only occurrence in the repository. Co-Authored-By: Claude Fable 5 <[email protected]>
Related: #101099
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a
Invalid number of rows in Chunklogical error when anINTERPOLATEtarget is an alias of aWITH FILLcolumn with the old analyzer (enable_analyzer = 0). Such queries are now rejected with a clearINVALID_WITH_FILL_EXPRESSIONerror.Description
Found by the AST fuzzer on PR #101099 (
STID: 3366-35de,AST fuzzer (amd_debug)), on a PR that only touchesProcessListand does not touchFillingTransform-- a pre-existing trunk bug. Fix provided in this separate PR per @ alexey-milovidov's request.Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101099&sha=4e01b0f24bf0c5eb934973bb3ea83a976479cce0&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29
Deterministic minimal reproducer (old analyzer only):
Root cause: with the old analyzer, an
INTERPOLATEtarget that only aliases aWITH FILLcolumn is not materialized as a separate column, sointerpolate_column_positionsresolves to the same header position asfill_column_positions. Each generated gap-fill row is then written into that position twice (once by the filling loop, once by the interpolate loop) while other columns get a single insert, producing a chunk with inconsistent row counts. The new analyzer materializes a distinct column, so it is unaffected.The
FillingTransformconstructor already guards the analogous sorting-prefix-vs-interpolate overlap. This PR adds the same guard for the fill-vs-interpolate overlap. Interpolating a column that IS the fill column is meaningless (its value is fully determined by the fill), so rejecting it withINVALID_WITH_FILL_EXPRESSIONis the correct behavior; no previously-working query is affected (these queries abort today).Version info
26.7.1.951(included in26.7and later)