feat!: open_reader accepts optional size to skip HEAD request#664
Merged
kylebarron merged 3 commits intodevelopmentseed:mainfrom Apr 16, 2026
Merged
Conversation
7b38e1e to
e3a6e25
Compare
kylebarron
requested changes
Apr 13, 2026
05cfcd7 to
b4a8f2a
Compare
b4a8f2a to
07a5221
Compare
Member
|
Forgot to mark this as breaking because it removes the |
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
Add an optional
sizeparameter toobstore.open_reader/open_reader_asyncthat lets callers skip theHEADrequest used to fetch the file size when the size is already known from external metadata.create_readercurrently HEADs the object solely to populate anObjectMeta, butBufReader::with_capacityconsumes onlymeta.locationandmeta.sizefrom it. There is a network round-trip per file to fetch a singleu64.The same pattern already exists one layer up in the arrow-rs workspace:
parquet::arrow::async_reader::ParquetObjectReader::with_file_size(u64)accepts an optional size hint asOption<u64>. Python-side similar examples exist infsspec.AbstractBufferedFile(size=None)andpyarrow.dataset.FileFormat.make_fragment(file_size=None).When
sizeis provided,create_readerconstructs theObjectMetadirectly with the hint and skips theHEADentirely. WhensizeisNone, behavior is the same as before.Notes
The caller is responsible for the
sizevalue being accurate.Failure modes:
OSErrorat read time, when a range request past EOF is issued (Invalid range).