Skip to content

refactor: activate exact current-format writers - #8023

Merged
Xuanwo merged 24 commits into
mainfrom
xuanwo/exact-version-stack-06-writers
Jul 31, 2026
Merged

refactor: activate exact current-format writers#8023
Xuanwo merged 24 commits into
mainfrom
xuanwo/exact-version-stack-06-writers

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Part 6/12 of #7877. Depends on #8022.

This is an independently reviewable step toward the final layout demonstrated in #7979.

This PR switches the public file writer boundary to exact-version dispatch. The root FileWriter becomes type erasure plus forwarding, while V1 and each current format own construction and behavior inside their version modules. Writer call sites in Lance, indexes, Python, and Java now pass an exact ConcreteFileVersion.

This removes version-conditioned behavior from the shared current-format writer and makes every temporary, shuffle, merge, and dataset file creation site choose a format explicitly. Reader dispatch is intentionally deferred to the next PR.

Validation:

  • cargo clippy --all --tests --benches -- -D warnings
  • uv run make build in python/
  • cargo check --manifest-path java/lance-jni/Cargo.toml
  • exact-version compatibility fixture tests

Xuanwo added 18 commits July 21, 2026 16:47
…mat-identity

# Conflicts:
#	rust/lance-file/src/reader.rs
#	rust/lance/src/dataset/transaction.rs
@github-actions github-actions Bot added A-python Python bindings A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-encoding Encoding, IO, file reader/writer labels Jul 27, 2026
Base automatically changed from xuanwo/exact-version-stack-05-file-runtime to main July 31, 2026 07:48
@Xuanwo
Xuanwo marked this pull request as ready for review July 31, 2026 08:44
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.45161% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-file/src/versions/mod.rs 78.46% 12 Missing and 2 partials ⚠️
rust/lance-index/src/vector/v3/shuffler.rs 40.00% 3 Missing ⚠️
rust/lance/src/dataset/optimize/binary_copy.rs 71.42% 2 Missing ⚠️
rust/lance/src/index/vector/ivf/builder.rs 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Xuanwo
Xuanwo requested a review from lance-community July 31, 2026 10:01
@lance-gatekeeper
lance-gatekeeper Bot removed the request for review from lance-community July 31, 2026 10:02
@Xuanwo
Xuanwo requested a review from lance-community July 31, 2026 10:19
@lance-gatekeeper
lance-gatekeeper Bot removed the request for review from lance-community July 31, 2026 10:19
@Xuanwo
Xuanwo requested a review from lance-community July 31, 2026 11:06
@lance-gatekeeper
lance-gatekeeper Bot removed the request for review from lance-community July 31, 2026 11:06

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact-version dispatch fixes a real format-safety boundary: encoding selection and footer identity now have one owner, and the Rust, dataset, index, Python, and Java paths resolve selectors before construction. Stable V2.0–V2.2 fixtures retained byte identity, V2.3 remained deterministic, and the migrated binary-copy and shuffle paths passed targeted tests.

The remaining risk is the intentional removal of low-level Rust writer APIs without a deprecation bridge, which conflicts with this repository’s public-API policy and shifts migration cost to downstream users. If maintainers accept that compatibility tradeoff, I found no format or correctness blocker.

@Xuanwo
Xuanwo requested a review from lance-community July 31, 2026 11:49
@lance-gatekeeper
lance-gatekeeper Bot removed the request for review from lance-community July 31, 2026 11:49
@Xuanwo
Xuanwo requested a review from lance-community July 31, 2026 12:16
@lance-gatekeeper
lance-gatekeeper Bot removed the request for review from lance-community July 31, 2026 12:16

@BubbleCal BubbleCal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact-version writer dispatch looks good overall. I left one question about the removed regression coverage.

}
}

#[cfg(test)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was removing this entire regression-test module intentional? I could not find equivalent coverage under the new version-specific writers for unequal-length column writes, page-size limits, compression overrides, or page-metadata spilling. Could we migrate these tests instead of dropping them?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was an artifact of the stacked PR boundary. The tests are migrated in the reader PR, but you are right that this PR should not temporarily drop the writer regression coverage. I’ll move the existing writer tests into a standalone test module here, keep them on the current reader API, and leave only the reader-side migration to the next PR.

@Xuanwo
Xuanwo merged commit 20c7378 into main Jul 31, 2026
41 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/exact-version-stack-06-writers branch July 31, 2026 18:16
Xuanwo added a commit that referenced this pull request Aug 4, 2026
Part 7/12 of #7877. Depends on
#8023.

This is an independently reviewable step toward the final layout
demonstrated in #7979.

This PR gives V2.0, V2.1, V2.2, and V2.3 explicit reader composition
alongside V1. The root reader keeps shared runtime machinery and
type-erased forwarding, but exact version modules own construction,
decoder selection, and supported capabilities.

The large shared reader implementation is reduced to mechanisms that are
actually common. Version-sensitive choices no longer depend on ordering
comparisons or scattered conditions, and the reader still parses
persisted identity once at the boundary.

Validation:

* `cargo test -p lance-file`
* `cargo clippy --all --tests --benches -- -D warnings`
* `uv run make build` in `python/`
* `cargo check --manifest-path java/lance-jni/Cargo.toml`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-python Python bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants