fix(update): keep nested-field index correct when updating a struct column#7412
Merged
jackye1995 merged 1 commit intoJun 23, 2026
Merged
Conversation
…olumn The update API rejects nested column references, so a nested field can only be changed by setting its whole top-level struct column. commit_impl built `fields_for_preserving_frag_bitmap` from the struct's own (parent) field id, so an index on a nested child field was absent from the set. The RewriteRows index maintenance then wrongly extended that child-field index over the rewritten fragment, leaving the updated rows unscanned and silently dropped from queries on the index. Collect the full field subtree of each updated column so indices on nested child fields are recognized as modified. Flat columns are unaffected.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
westonpace
approved these changes
Jun 23, 2026
| dataset: Arc<Dataset>, | ||
| update_data: UpdateData, | ||
| ) -> Result<UpdateResult> { | ||
| // Updated columns are top-level (nested references are rejected by `set`), but a |
Member
There was a problem hiding this comment.
I'm surprised that updated columns have to be top-level? I would think we could do an update on a nested column.
Contributor
Author
There was a problem hiding this comment.
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.
The update API rejects nested column references (
seterrors on a.in the column name), so a nested field can only be changed by setting its whole top-level struct column (e.g.SET s = named_struct('x', …)).commit_implbuiltfields_for_preserving_frag_bitmapfrom the struct column's own (parent) field id viafield_id(column_name), so an index on a nested child field (a different leaf id) was absent from the set.register_pure_rewrite_rows_update_frags_in_indicesthen wrongly extended that child-field index over the rewritten fragment, which was therefore treated as indexed and never re-scanned — so the updated rows were silently dropped from queries on the index (false negatives).The fix collects the full field subtree of each updated column, so a struct-column update marks all descendant field ids as modified. Flat columns are unaffected (no children).
This is the SQL
UPDATEcounterpart of the merge_insert fix in #7410. Adds a regression test (test_update_struct_column_keeps_nested_index): a BTree index ons.x, an update of the struct columns, and an assertion that the index's effective fragment bitmap is not extended over the rewritten fragment so the updated value is still found.