Skip to content

feat(writer): add PositionDeleteInput builder - #3230

Open
laskoviymishka wants to merge 1 commit into
apache:mainfrom
laskoviymishka:feat/position-delete-input
Open

laskoviymishka wants to merge 1 commit into
apache:mainfrom
laskoviymishka:feat/position-delete-input

Conversation

@laskoviymishka

Copy link
Copy Markdown
Contributor

What changes are included in this PR?

Add PositionDeleteInputBuilder, a small helper that assembles a spec-conforming position delete RecordBatch from (path, pos) rows.

The batch has exactly the two required position delete columns (file_path: Utf8, pos: Int64), both non-null and carrying the reserved field ids, so it passes PositionDeleteFileWriter's per-batch validation and can be handed straight to that writer. An empty builder still produces a valid 0-row batch.

To keep a single source of truth for the field-id wiring, the Arrow schema is no longer hand-wired in the builder. This commit un-gates the previously test-only POSITION_DELETE_ARROW_SCHEMA static and position_delete_arrow_schema() helper in position_delete_writer.rs, making the helper pub(crate), and the builder now obtains the shared Arrow projection through it as a cheap Arc clone.

extend accepts any iterator of (Into, i64) rows, and build debug-asserts the paths/positions length invariant. The module docs note that rows are materialized into two heap Vecs before the batch is built (so very large inputs should use one builder per write batch), that the optional third row column is not supported yet, and that position delete files are a v2 construct which v3 forbids, so a format-version gate must be applied at the transaction/commit layer.

Which issue does this PR close?

Relates to #340 and #2218.

Are these changes tested?

yes, new and existing tests

Add PositionDeleteInputBuilder, a small helper that assembles a
spec-conforming position delete RecordBatch from (path, pos) rows.

The batch has exactly the two required position delete columns
(file_path: Utf8, pos: Int64), both non-null and carrying the reserved
field ids, so it passes PositionDeleteFileWriter's per-batch validation
and can be handed straight to that writer. An empty builder still
produces a valid 0-row batch.

To keep a single source of truth for the field-id wiring, the Arrow
schema is no longer hand-wired in the builder. This commit un-gates the
previously test-only POSITION_DELETE_ARROW_SCHEMA static and
position_delete_arrow_schema() helper in position_delete_writer.rs,
making the helper pub(crate), and the builder now obtains the shared
Arrow projection through it as a cheap Arc clone.

extend accepts any iterator of (Into<String>, i64) rows, and build
debug-asserts the paths/positions length invariant. The module docs
note that rows are materialized into two heap Vecs before the batch is
built (so very large inputs should use one builder per write batch),
that the optional third row column is not supported yet, and that
position delete files are a v2 construct which v3 forbids, so a
format-version gate must be applied at the transaction/commit layer.

Relates to apache#340 and apache#2218.
@laskoviymishka
laskoviymishka marked this pull request as ready for review September 15, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant