feat: Implement PositionDeleteWriter for position delete files#582
Merged
wgtmac merged 4 commits intoapache:mainfrom Mar 15, 2026
Merged
feat: Implement PositionDeleteWriter for position delete files#582wgtmac merged 4 commits intoapache:mainfrom
wgtmac merged 4 commits intoapache:mainfrom
Conversation
Implement the PositionDeleteWriter following the same PIMPL pattern as DataWriter. The writer supports both buffered WriteDelete(file_path, pos) calls and direct Write(ArrowArray*) for pre-formed batches. Metadata reports content=kPositionDeletes with sort_order_id=nullopt per spec, and tracks referenced_data_file when all deletes target a single file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
evindj
reviewed
Mar 11, 2026
Contributor
evindj
left a comment
There was a problem hiding this comment.
Thanks for working on implementing this feature. The change looks good, my only comment is around the threshold for flushing data.
Make kFlushThreshold configurable via PositionDeleteWriterOptions with a default of 1000. Add AutoFlushOnThreshold test that uses a small threshold to verify the automatic flush logic.
evindj
approved these changes
Mar 11, 2026
wgtmac
requested changes
Mar 13, 2026
Member
wgtmac
left a comment
There was a problem hiding this comment.
Review Summary
I have reviewed the changes against the Java implementation for strict parity, C++ styling, and logic issues. There are a few logic and parity concerns that need to be addressed, mainly regarding RAII memory safety in FlushBuffer, metrics filtering for delete columns, and tracking referenced_paths_ during batch writes.
Note: This review was generated by Gemini.
- Use ArrowSchemaGuard/ArrowArrayGuard in FlushBuffer for memory safety on early returns, fixing potential leaks when nanoarrow macros fail - Fix guards to handle already-consumed arrays (null release check) - Filter out value_counts/null_value_counts/nan_value_counts for delete metadata columns (file_path, pos) to match Java parity; also drop bounds when referencing multiple data files - Add TODO for extracting paths from ArrowArray in Write() to update referenced_paths_ for batch writes - Add TODO for row_schema support in position deletes (V2 spec)
wgtmac
approved these changes
Mar 15, 2026
Member
wgtmac
left a comment
There was a problem hiding this comment.
Thanks @shangxinli for adding this and @evindj for the review!
89c5ca7 to
035f171
Compare
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.
Implement the PositionDeleteWriter following the same PIMPL pattern as DataWriter. The writer supports both buffered WriteDelete(file_path, pos) calls and direct Write(ArrowArray*) for pre-formed batches. Metadata reports content=kPositionDeletes with sort_order_id=nullopt per spec, and tracks referenced_data_file when all deletes target a single file.