Skip to content

RFC: Add limited read - #7945

Merged
Xuanwo merged 5 commits into
mainfrom
xuanwo/rfc-limited-read
Aug 26, 2026
Merged

RFC: Add limited read#7945
Xuanwo merged 5 commits into
mainfrom
xuanwo/rfc-limited-read

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 24, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Refs #7938.

Rationale for this change

A bounded read range is exact, so callers that only need up to a small number of bytes must stat the object first or handle a short object as an error. OpenDAL needs an at-most read for probes such as file header and format detection without an extra metadata request.

What changes are included in this PR?

This PR proposes ReadOptions::limit and Operator::read_with(...).limit(n). The proposal keeps exact bounded range behavior, uses the existing raw open and read split, and carries only a private exact boolean in core instead of adding a new raw operation or planning abstraction.

Are there any user-facing changes?

Yes. The proposed API returns between zero and the configured limit on clean EOF. Existing reads that do not set limit keep their current behavior. This PR contains the RFC only; it does not implement the API.

AI Usage Statement

This proposal was drafted with assistance from OpenAI Codex powered by GPT-5.

@Xuanwo
Xuanwo marked this pull request as ready for review July 27, 2026 05:25
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Jul 27, 2026
Comment thread core/core/src/docs/rfcs/7945_limited_read.md Outdated
Comment thread core/core/src/docs/rfcs/7945_limited_read.md Outdated
Comment thread core/core/src/docs/rfcs/7945_limited_read.md Outdated

@dentiny dentiny left a comment

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.

Thank you!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 25, 2026
@Xuanwo
Xuanwo merged commit 75c089b into main Aug 26, 2026
101 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/rfc-limited-read branch August 26, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants