{{ message }}
Fix exception when selecting _row_number with other virtual columns#100116
Merged
Conversation
…uestedFileLikeStorageVirtualsToChunk` In `addRequestedFileLikeStorageVirtualsToChunk`, the `_row_number` handling block used `return` instead of `continue` after adding the column to the chunk. This caused the function to exit the loop early, skipping any remaining virtual columns (e.g. `_data_lake_snapshot_version`). When a query requested both `_row_number` and `_data_lake_snapshot_version`, the chunk would have fewer columns than expected, resulting in: "Invalid number of columns in chunk pushed to OutputPort." #87890 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_version together Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Contributor
LLVM Coverage ReportPR changed lines: PR changed-lines coverage: 100.00% (6/6, 0 noise lines excluded) |
1 task
alexey-milovidov
added a commit
that referenced
this pull request
Mar 21, 2026
…hunk` In `addRequestedFileLikeStorageVirtualsToChunk`, the `_row_number` handling block uses `return` instead of `continue` after adding the column to the chunk. This causes the function to exit the loop early, skipping any remaining virtual columns (e.g. `_data_lake_snapshot_version`). When a query requests both `_row_number` and another virtual column after it, the chunk has fewer columns than expected, resulting in: "Invalid number of columns in chunk pushed to OutputPort." The fix was originally in #100116 but was lost during merge because #100208 (revert of #99163) had reintroduced the `return` on master after the fix branch had already resolved it via a different code structure. The regression test `04050_iceberg_virtual_columns_return_bug` is already on master from #100116. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100177&sha=f10711f066fd101124e088ce33061de51ebae0e9&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 #87890 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
arthurpassos
pushed a commit
to Altinity/ClickHouse
that referenced
this pull request
May 13, 2026
…hunk` In `addRequestedFileLikeStorageVirtualsToChunk`, the `_row_number` handling block uses `return` instead of `continue` after adding the column to the chunk. This causes the function to exit the loop early, skipping any remaining virtual columns (e.g. `_data_lake_snapshot_version`). When a query requests both `_row_number` and another virtual column after it, the chunk has fewer columns than expected, resulting in: "Invalid number of columns in chunk pushed to OutputPort." The fix was originally in ClickHouse#100116 but was lost during merge because ClickHouse#100208 (revert of ClickHouse#99163) had reintroduced the `return` on master after the fix branch had already resolved it via a different code structure. The regression test `04050_iceberg_virtual_columns_return_bug` is already on master from ClickHouse#100116. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100177&sha=f10711f066fd101124e088ce33061de51ebae0e9&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 ClickHouse#87890 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

In
addRequestedFileLikeStorageVirtualsToChunk, the_row_numberhandling block usedreturninstead ofcontinueafter adding the column to the chunk. This caused the function to exit the loop early, skipping any remaining virtual columns (e.g._data_lake_snapshot_version). When a query requested both_row_numberand_data_lake_snapshot_version, the chunk would have fewer columns than expected, causing an exception: "Invalid number of columns in chunk pushed to OutputPort."Closes #87890
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix exception "Invalid number of columns in chunk" when selecting
_row_numbertogether with other virtual columns like_data_lake_snapshot_version.Documentation entry for user-facing changes
Version info
26.4.1.99