fix(java): rename DatasetDelta JNI bindings to match Java declarations#6963
Merged
yanghua merged 2 commits intoMay 28, 2026
Merged
Conversation
The Java side declares three native methods using the nativeXxx convention: private native List<Transaction> nativeListTransactions(); private native void nativeGetInsertedRows(long streamAddress); private native void nativeGetUpdatedRows(long streamAddress); But the Rust exports in java/lance-jni/src/delta.rs were named without the `native` prefix: Java_org_lance_delta_DatasetDelta_listTransactions Java_org_lance_delta_DatasetDelta_getInsertedRows Java_org_lance_delta_DatasetDelta_getUpdatedRows The JVM looks up `Java_<package>_<class>_<javaMethodName>`, so these bindings never matched and every call into DatasetDelta.listTransactions, getInsertedRows, or getUpdatedRows throws UnsatisfiedLinkError from the published lance-core jar (verified on 7.0.0-rc.1). releaseNativeDelta was already correctly named. This rename was masked by DeltaTest catching UnsatisfiedLinkError and calling Assumptions.assumeTrue(false, ...), so CI silently skipped the broken tests instead of failing. Test cleanup is left for a separate change to keep this fix focused.
The previous "catch UnsatisfiedLinkError -> Assumptions.assumeTrue(false)" pattern silently skipped both tests for as long as the JNI binding mismatch in delta.rs was in place. Once the preceding rename commit lets the native methods resolve, two real test-setup defects surface: * memory:// URI does not persist commits across separate Dataset.write() calls. Each .execute() returned a Dataset reference, but the v2 commit was not visible to a sibling Dataset reference reopening the URI. Switch both tests to a @TempDir-backed file URI, matching every other test in this module. * testInsertedRowsComparedAgainst expects _row_created_at_version / _row_last_updated_at_version columns in the delta output. These row lineage columns are only emitted when the dataset is created with stable row IDs enabled. Add .enableStableRowIds(true) to the v1 write. * Drop the now-dead UnsatisfiedLinkError catches and the Assumptions import; extract a writeBatch() helper to deduplicate the Arrow batch serialization between the two tests. Both tests now genuinely cover the DatasetDelta JNI bindings end-to-end.
Contributor
Author
|
cc @Xuanwo @hamersaw @jackye1995 FYI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6962. The Rust exports in
java/lance-jni/src/delta.rswere named without thenativeprefix that the Java side declares, so every call into the threeDatasetDeltanative methods failed withUnsatisfiedLinkError. This renames the exports and fixes two unrelated DeltaTest fixture problems that the JNI bug had been silently masking.Changes
Java_org_lance_delta_DatasetDelta_listTransactions/getInsertedRows/getUpdatedRowsinjava/lance-jni/src/delta.rsto add thenativeprefix.releaseNativeDeltawas already correct.memory://URIs (which do not persist commits across separateDataset.write()calls) to@TempDir-backed file URIs, matching every other test in the module..enableStableRowIds(true)to the v1 write intestInsertedRowsComparedAgainstso the expected_row_created_at_version/_row_last_updated_at_versionrow-lineage columns appear in the delta output.catch (UnsatisfiedLinkError) -> Assumptions.assumeTrue(false, ...)skip pattern and theAssumptionsimport.writeBatch()helper to deduplicate the Arrow batch serialization between the two tests.Testing
./mvnw test -Dtest=DeltaTest -DskipNativeBuild=true— both tests now pass instead of silently skipping.nm -gU java/lance-jni/target/debug/liblance_jni.dylib | grep DatasetDelta— confirms the four expected exports (nativeListTransactions,nativeGetInsertedRows,nativeGetUpdatedRows,releaseNativeDelta).