Repository navigation
Fix exception when ORDER BY WITH FILL is used with LIMIT BY - #98361
Merged
Merged
Conversation
When both `ORDER BY ... WITH FILL` and `LIMIT BY` are used together, the `ActionsChain` optimization removes ORDER BY columns from the `before_limit_by_actions` step output because they appear unused by subsequent analysis steps. However, the `FillingStep` (added later during plan construction) requires these columns in the block header, causing a "Filling column ... is not present in the block" exception. The fix preserves ORDER BY columns in the LIMIT BY expression step when `WITH FILL` is used, similar to how they are already preserved for distributed query processing. Closes #84427 https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98291&sha=18aa50a0669a66282b7596ca1393799490f8aeb2&name_0=PR&name_1=BuzzHouse%20%28amd_tsan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [3b164e8] Summary: ❌
|
4 tasks done
Contributor
|
Hi @alexey-milovidov — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
Contributor
|
Apologies for the duplicate notification — we had a race condition in our notification system where multiple processes posted simultaneously. The duplicate has been removed and we've added a strict 3-layer dedup guard (DB lock + immediate key + GitHub comment check) to ensure this cannot happen again. |
This was referenced Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ORDER BY ... WITH FILLis combined withLIMIT BYActionsChainoptimization removed ORDER BY columns from thebefore_limit_by_actionsstep output, but they are required by theFillingStepadded laterWITH FILLis used, similar to how they are already preserved for distributed query processingCloses #84427
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98291&sha=18aa50a0669a66282b7596ca1393799490f8aeb2&name_0=PR&name_1=BuzzHouse%20%28amd_tsan%29
#98291
Test plan
04005_with_fill_limit_bycoveringORDER BY ... WITH FILL ... LIMIT BYcombinationSELECT 1 ORDER BY rank() OVER () WITH FILL LIMIT 1 BY 1) is also fixed03366_with_fill_dagstill passesChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix exception when
ORDER BY ... WITH FILLis used together withLIMIT BY.🤖 Generated with Claude Code
Version info
26.3.1.230