Repository navigation
Fix logical error on WITH FILL INTERPOLATE over a constant fill column - #108913
Conversation
A column used in ORDER BY ... WITH FILL must not also be an INTERPOLATE output. The validation in `FillingTransform` only compared the INTERPOLATE output set against the sort description alias, which is empty for a constant ORDER BY expression. Under the old analyzer a constant fill column and a matching INTERPOLATE target are folded to the same source column, so the conflict slipped through and the query aborted later with `Invalid number of rows in Chunk` (`LOGICAL_ERROR`) instead of a clean `INVALID_WITH_FILL_EXPRESSION` exception. Also check the sort description column name, which holds the resolved name of the constant, so the conflict is rejected up front. Found by the AST fuzzer on #68978: SELECT 1024 AS a, a AS b ORDER BY 1 DESC NULLS FIRST WITH FILL STALENESS -2 INTERPOLATE (`a` AS b) Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=68978&sha=26b3af8d64543b2cd912305df751a31e967c03bf&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [f1634bd] Summary: ✅ AI ReviewSummaryThis PR tightens Final VerdictStatus: ✅ Approve |
|
continue-pr triage (head Branch checked out clean, no conflicts with All CI reds are unrelated to this
I re-ran the failed jobs. Not re-merging |
|
continue-pr re-check (head The CI picture improved since the previous triage: the earlier flaky test reds ( Two jobs have failed so far, both unrelated to this
AI Review remains ✅ Approve, there are no unresolved review threads, no human change requests, and changed lines are 8/8 covered. No re-merge: merge-base |
|
continue-pr re-check (head The All three remaining reds are unrelated infrastructure/stress flakes, not reachable from a validation-only
I re-ran the failed jobs (attempt 3, queued). Not re-merging |
|
continue-pr re-check (head The real blocker is the required All three failing private jobs are unrelated to this
I re-ran the failed private jobs (attempt 2, queued). Public-side, the only reds are Not re-merging |
|
continue-pr re-check (head The only required blocker remains
These are recurring cross-PR Cloud flakes — the same two tests failed on an unrelated PR's private sync (#100651) the same day — so they are not caused by this change. The prior arm I re-ran the two failed private shards (run @groeneai, if the private sync stays red on these two Cloud-only tests after this rerun, could you investigate/waive them (or fix in a separate PR)? They are unrelated to this Public-side, the only reds are Not re-merging |
|
continue-pr triage response Confirmed after the queued reruns: the only red on this PR is the required 1. Already root-caused, fix in flight: PR #108890 (open, in review). It is a Keeper feature-flag propagation race on attach: when the flag re-check races, a coordinated refreshable MV ends up 2. Cloud-only: distributed cache has no OSS analogue, and this test has zero rows in the public CIDB over the last 30 days, so it cannot be reproduced or queried from the public side. Your own evidence points to a timing flake (this shard's failure shifted from |
|
continue-pr re-check (head Key delta since the previous triages: the required Public-side, the only remaining reds are
|
|
continue-pr re-check (head Re-verified 2 days after the last triage; nothing changed the merge-readiness:
The only public reds are Not re-merging |
…polate-constant-column
…nalyzer-scoped The AI review asked whether `SELECT 1 AS a, 1 AS x ORDER BY a WITH FILL FROM 1 TO 5 INTERPOLATE (`x` AS x)` should be rejected, since `x` is a distinct output column from the fill key `a` and should interpolate independently. Under the current analyzer it is indeed valid and interpolates `x` independently, so the new test case asserts it returns the interpolated rows. The rejection only fires under the legacy old analyzer, where identical constants are folded onto one shared source column and the very same query would otherwise abort with an `Invalid number of rows in Chunk` `LOGICAL_ERROR` (confirmed: the query throws that on unpatched code with `enable_analyzer = 0`). The fix therefore turns an internal logical error into a clean `INVALID_WITH_FILL_EXPRESSION` under the old analyzer; it does not reject distinct projections in general, which the new test guards against. Test-only change extending `04490_with_fill_interpolate_constant_fill_column`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
continue-pr re-check (head Fresh CI has now fully completed on the current head (after the master re-merge and the added new-analyzer positive test for the disputed query). All three required gates are green:
AI Review is back to ✅ Approve on this head ("the previously opened bot thread no longer holds against the current head"), and there are 0 unresolved review threads. The only two red jobs are pre-existing, CI-labeled flakes tracked by open issues, both unreachable from this validation-only
The combined status shows |
|
Heads-up on a master-side development that changes this PR's status: #110103 ("Fix logical error in The two fixes use different mechanisms in different places in the
Because this PR's check runs first, it still fires (with the original message) for the queries it catches, so merging Design call for you (your own PR — not touching it):
The branch merges cleanly against current |
|
Decision: keep. Confirmed both guards coexist after merging current master ( Reasons to keep over close:
Branch merges cleanly against master; no code change needed from me. |
…polate-constant-column
|
continue-pr: merged current The branch was behind
This matches the recorded keep decision (defense-in-depth, no overlap). The net delta this PR contributes over the new Built No behavior change beyond keeping the branch current; leaving the merge to a human as usual. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 8/8 (100.00%) · Uncovered code |
|
The only red on the current head Since the user-visible fix has already shipped via #110103, and per the earlier decision to keep this PR as defense-in-depth (name-based check + extra regression coverage, including the No code changes; the branch already contains current |
…terpolate-constant-column Fix logical error on WITH FILL INTERPOLATE over a constant fill column
A column used in
ORDER BY ... WITH FILLmust not also be anINTERPOLATEoutput. The validation inFillingTransformonly compared theINTERPOLATEoutput set against the sort description alias, which is empty for a constantORDER BYexpression. Under the old analyzer a constant fill column and a matchingINTERPOLATEtarget are folded to the same source column, so the conflict slipped through the check and the query later aborted withInvalid number of rows in Chunk(LOGICAL_ERROR) instead of a cleanINVALID_WITH_FILL_EXPRESSIONexception (WITH FILLgenerates extra rows for the fill column while the interpolated column does not).The fix also checks the sort description column name, which holds the resolved name of the constant, so the conflict is rejected up front.
Found by the AST fuzzer on #68978 (unrelated to that PR's changes):
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=68978&sha=26b3af8d64543b2cd912305df751a31e967c03bf&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
Update (2026-07-17): while this PR was open, #110103 landed on
masterwith a complementary position-based check that fixes the same user-visibleLOGICAL_ERROR; the per-arch Bugfix validation jobs confirm the bug no longer reproduces onmasterHEAD. Per the review discussion, this PR is kept as defense-in-depth: the name-based check rejects the conflict at the level of resolved column names, and the04490test adds regression coverage (including anenable_analyzer = 1positive case) that is not covered by the test from that PR. Since the user-visible fix already shipped, the changelog category is now "Not for changelog".Related: #110103
Changelog category (leave one):
Documentation entry for user-facing changes
Version info
26.7.1.1142(included in26.7and later)