Skip to content

feat(java): expose core reader tuning options in Java bindings - #8259

Open
jihuayu wants to merge 4 commits into
apache:mainfrom
jihuayu:codex/8252
Open

feat(java): expose core reader tuning options in Java bindings#8259
jihuayu wants to merge 4 commits into
apache:mainfrom
jihuayu:codex/8252

Conversation

@jihuayu

@jihuayu jihuayu commented Sep 8, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #8252.

Rationale for this change

Java input streams cannot configure the core reader’s chunking, concurrency, or prefetching. Exposing these controls separately from ReadOptions keeps reader execution settings distinct from the logical read range.

Considering that ReadOptions and ReaderOptions are separate abstractions in OpenDAL, I think we should introduce a new ReaderOptions configuration in the Java binding instead of extending ReadOptions with reader-specific controls.

gap is not exposed because Java’s InputStream uses the core’s into_bytes_iterator(range) to read a single continuous range. The option only affects range merging in Reader::fetch, which the Java binding does not currently expose.

What changes are included in this PR?

  • Add ReaderOptions with concurrent, chunk, prefetch, and contentLengthHint.
  • Add createInputStream(path, readOptions, readerOptions) and map its execution settings to core options through JNI.
  • Validate option values and use checked numeric conversions.
  • Add mapping and stream behavior tests, and document option semantics and resource usage.

Are there any user-facing changes?

Yes. Java callers can enable chunked reads by setting a positive chunk and tune internal request concurrency and buffering. Setting concurrent alone does not enable concurrent range reads.

Existing overloads and constructors remain available with their default unchunked streaming behavior. Invalid reader option values produce OpenDALException with code ConfigInvalid when the stream is created.

AI Usage Statement

I used GPT-6 to complete the implementation and to write the tests and documentation. I personally reviewed all of the code.

@jihuayu
jihuayu requested a review from tisonkun as a code owner September 8, 2026 08:50
* @return a stream that the caller must close
* @throws OpenDALException if reader options are invalid (ConfigInvalid) or creation fails
*/
public OperatorInputStream createInputStream(String path, ReadOptions readOptions, ReaderOptions readerOptions) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ReadOptions overlaps ReaderOptions. It seems we should just accept ReaderOptions here?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new feature: expose core reader tuning options in Java bindings

2 participants