Skip to content

fix(jni): align CommitBuilder.storageFormat() parsing with LanceFileVersion::from_str - #8063

Open
ivscheianu wants to merge 2 commits into
lance-format:mainfrom
ivscheianu:fix/jni-parse-storage-format
Open

fix(jni): align CommitBuilder.storageFormat() parsing with LanceFileVersion::from_str#8063
ivscheianu wants to merge 2 commits into
lance-format:mainfrom
ivscheianu:fix/jni-parse-storage-format

Conversation

@ivscheianu

@ivscheianu ivscheianu commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #8066

The JNI parse_storage_format (used by CommitBuilder.storageFormat()) had a hand-rolled match that only accepted prefixed aliases ("v2_1", "v2.1") while extract_write_params uses LanceFileVersion::from_str which accepts the canonical numeric forms ("2.1", "2.2"). This surfaced when lance-spark#730 started propagating file_format_version to CommitBuilder.storageFormat(), breaking some tests.

Fix:

  • Replace the custom match with name.parse::<LanceFileVersion>().
  • Extend FromStr to also accept the prefixed aliases so no previously valid input is rejected.
  • Update CommitBuilder.storageFormat() Javadoc.
  • Add tests for canonical forms, prefixed aliases, case-insensitivity, and invalid input.

@github-actions github-actions Bot added A-java Java bindings + JNI bug Something isn't working labels Jul 29, 2026
@ivscheianu
ivscheianu force-pushed the fix/jni-parse-storage-format branch 2 times, most recently from 0ecde63 to d66de1c Compare July 29, 2026 06:30
@github-actions github-actions Bot added the A-encoding Encoding, IO, file reader/writer label Jul 29, 2026
…ersion::from_str

The JNI `parse_storage_format` function (used by `CommitBuilder.storageFormat()`)
had a hand-rolled match that accepted only a subset of format strings ("v2.1",
"v2_1", etc.) while the fragment creation path (`extract_write_params`) uses
`LanceFileVersion::from_str` which also accepts the canonical numeric forms
("2.1", "2.2").

This inconsistency causes `CommitBuilder.storageFormat("2.1")` to fail with
"Unknown storage format: 2.1" even though the same string works correctly
in `WriteParams.dataStorageVersion`.

Replace the custom match with `name.parse::<LanceFileVersion>()` and extend
`FromStr` to also accept the prefixed aliases ("v2_0", "v2.0", etc.) so no
previously accepted values are rejected.
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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-java Java bindings + JNI bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: CommitBuilder.storageFormat() rejects canonical version strings like "2.1"

1 participant