feat(java): add Dataset.takeRows() for physical row ID access#6772
Merged
Conversation
Add a JNI binding for Rust's Dataset::take_rows(), which fetches rows by their stable physical row IDs (from the _rowid system column) rather than logical indices. Mirrors the existing take() API but uses row IDs that persist across compaction and deletion. The Rust side already exposes take_rows() -- this commit wires it through JNI to Java. Changes: - blocking_dataset.rs: nativeTakeRows JNI function + inner_take_rows - Dataset.java: takeRows() public method + nativeTakeRows native declaration - DatasetTest.java: testTakeRows with ordering verification and edge cases
hamersaw
approved these changes
May 14, 2026
Contributor
hamersaw
left a comment
There was a problem hiding this comment.
Thanks for the PR! Looks great.
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
Adds
Dataset.takeRows(List<Long> rowIds, List<String> columns)to the Java SDK, mirroring Rust's existingDataset::take_rows()by adding a JNI bindingtake()accepts logical row indices (positions).takeRows()accepts physical row IDs from the_rowidsystem column — these are stable across compaction and deletion, which makes them suitable for applications that store row IDs externally (e.g., in a secondary index) and later need to fetch the corresponding row data.Changes
java/lance-jni/src/blocking_dataset.rs: JNI shimnativeTakeRows+inner_take_rows— mirrorsinner_takebut callsdataset.take_rows()instead ofdataset.take()java/src/main/java/org/lance/Dataset.java: publictakeRows()method + native declarationjava/src/test/java/org/lance/DatasetTest.java:testTakeRowscovering correctness, input-order preservation, and edge cases (empty/null rejection)