Skip to content

feat: add fragment range read to Java API#6490

Open
bryanck wants to merge 3 commits intolance-format:mainfrom
bryanck:no-count-check
Open

feat: add fragment range read to Java API#6490
bryanck wants to merge 3 commits intolance-format:mainfrom
bryanck:no-count-check

Conversation

@bryanck
Copy link
Copy Markdown
Contributor

@bryanck bryanck commented Apr 13, 2026

This PR exposes a fragment range read method in the Java API. It adds a new readRange method to the Java Fragment class that calls a new JNI native method. Currently the only way to read a range from a fragment is to use the dataset scanner, however the dataset scanner always calls count_all_rows on the dataset when bounds checking a range. That adds overhead to the operation.

An alternative approach would be to add an option to disable the bounds check when using dataset scanner, but I felt this solution reflects the native API more closely.

Here's a CPU profile using dataset scanner (first) and fragment range read (second)...
Screenshot 2026-04-12 at 6 40 00 PM
Screenshot 2026-04-12 at 6 40 15 PM

@github-actions github-actions bot added enhancement New feature or request java labels Apr 13, 2026
@bryanck bryanck requested a review from jackye1995 April 13, 2026 01:43
public class FragmentMetadata implements Serializable {
private static final long serialVersionUID = -5886811251944130460L;
private final int id;
private final int id; // FIXME: change to long
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fragment ID should be a long but that is a fairly significant change so left that for a follow up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I opened this follow up to move fragment ID to long... #6498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant