Skip to content

fix: reject compared_against combined with a version range in delta - #9552

Merged
Xuanwo merged 1 commit into
lance-format:mainfrom
jackylee-ch:fix/java-deltabuilder-validation
Oct 23, 2026
Merged

Xuanwo merged 1 commit into
lance-format:mainfrom
jackylee-ch:fix/java-deltabuilder-validation

Conversation

@jackylee-ch

@jackylee-ch jackylee-ch commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

DatasetDeltaBuilder::build rejects compared_against_version combined with a begin/end range, but both bindings picked one mode before the core saw them. Python's LanceDataset.delta() forwarded the range only when compared_against was None, and the JNI nativeBuild forwarded it only when comparedAgainst was unset. So ds.delta(1, begin_version=3, end_version=7), or the same selection on the Java DatasetDeltaBuilder, returned the delta between version 1 and the dataset's current version with no error, although the Python docstring promises a ValueError.

Both bindings now forward every argument and let build reject the combination.

Behaviour change

Combining the two modes raises ValueError in Python and IllegalArgumentException in Java instead of returning a delta. In Java, setting only one end of the range still raises IllegalArgumentException, now with the core's "Must specify both" message instead of "Must specify either". Dataset.delta(long) and Dataset.delta(long, long) set a single mode and are unaffected.

Tests

test_delta_validation_errors and DeltaTest gain the conflicting case, which returned a delta before the fix; DeltaTest also pins the half-set message. Ran pytest python/tests/test_delta.py and ./mvnw test -Dtest=DeltaTest, plus make lint-python, spotless, and clippy with -D warnings on lance-jni.

@github-actions github-actions Bot added A-java Java bindings + JNI bug Something isn't working labels Sep 24, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 24, 2026
Python's `LanceDataset.delta()` and the JNI `nativeBuild` each picked one delta
mode before calling `DatasetDeltaBuilder::build`, so a range set together with
`compared_against` was dropped and the call returned the delta between
`compared_against` and the current version. Forward every argument so `build`
rejects the combination.
@jackylee-ch
jackylee-ch force-pushed the fix/java-deltabuilder-validation branch from 1a31c37 to fca2267 Compare October 21, 2026 09:34
@github-actions github-actions Bot added the A-python Python bindings label Oct 21, 2026
@jackylee-ch jackylee-ch changed the title fix(java): validate DatasetDeltaBuilder version selection fix: reject compared_against combined with a version range in delta Oct 21, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 21, 2026

@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.

✅ Gate recommendation: approve.

Forwarding every supplied field lets the Rust builder enforce the documented version-selection rules in both Python and Java. This prevents conflicting arguments from silently selecting the wrong delta while keeping validation in one place.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 21, 2026
@Xuanwo
Xuanwo merged commit 5001b88 into lance-format:main Oct 23, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-java Java bindings + JNI A-python Python bindings bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants