laskoviymishka opened a new pull request, #2986:
URL: https://github.com/apache/iceberg-rust/pull/2986

   ## Which issue does this PR close?
   
   Closes #340.
   
   ## What changes are included in this PR?
   
   Adds a `PositionDeleteFileWriter` (and its builder) under
   `crates/iceberg/src/writer/base_writer/`, filling the slot the module doc
   already named. It writes a spec-conforming position delete file — the two
   required columns `file_path` (`string`, reserved field id 2147483546) and 
`pos`
   (`long`, 2147483545) — and tags the resulting `DataFile` with
   `DataContentType::PositionDeletes` on close.
   
   - `position_delete_schema()` / `position_delete_arrow_schema()` expose the
     canonical (memoized) schema, built from the existing `metadata_columns` 
field
     definitions, so no field-id constants are duplicated.
   - `write()` validates that each batch is exactly the two required, 
non-nullable,
     correctly-typed columns carrying the reserved field ids, and rejects a 
closed
     writer before validating — a clear error instead of a confusing failure 
deeper
     in the Parquet writer.
   - `close()` stamps `DataContentType::PositionDeletes`, propagates the 
partition
     key, and leaves `sort_order_id` null per the spec.
   - Modeled on the existing `equality_delete_writer.rs`.
   
   This is the first of a short series building out the delete-file write path.
   Deliberately out of scope here, planned as follow-ups: enforcing the
   `(file_path, pos)` sort order (the `write()` docs state the caller's
   responsibility until then), setting `referenced_data_file`, and a 
higher-level
   `DeltaWriter` (#2218) that routes inserts/deletes to the data / position /
   equality writers.
   
   ## Are these changes tested?
   
   Yes — 12 unit tests in the new module:
   
   - schema shape (reserved field ids, names, types, required flag, non-null 
Arrow
     projection);
   - a Parquet round-trip for single and multiple `write()` calls (write → read
     back → compare), asserting content type, record count, partition, and file
     size;
   - partition + `partition_spec_id` propagation on `close()`;
   - the validation matrix — wrong column count, missing/wrong field ids (both
     columns), wrong Arrow types (including `LargeUtf8` `file_path`, the common
     DataFusion / DuckDB / Polars shape), nullable columns, and write/close 
after
     close.
   
   `cargo test -p iceberg`, `cargo clippy`, and `cargo fmt --check` are clean.
   
   ## AI assistance disclosure
   
   Per the project's guidelines for AI-assisted contributions: this change was
   drafted with AI assistance (Claude Code), then reviewed, tested, and 
validated
   by the author — including a multi-agent code-review pass before opening.
   `cargo test`, `clippy`, and `fmt` were run locally.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to