Repository navigation
open_object: block_size=0 replaces the read_ahead flag - #2126
Merged
Merged
Conversation
`open_object` had two options for one setting: `block_size` sets the read-ahead block, and `read_ahead=False` turned read-ahead off. Now `block_size=0` turns it off and `read_ahead` is gone. The client translates 0 to `cache_type="none"` instead of passing it to fsspec: HfFileSystem opens a stream that can't seek for block_size=0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying datachain with
|
| Latest commit: |
48066f7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4de92946.datachain-2g6.pages.dev |
| Branch Preview URL: | https://refactor-open-block-size-zer.datachain-2g6.pages.dev |
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dreadatour
approved these changes
Oct 28, 2026
dreadatour
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me 👍 I like the idea of simplifying this.
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.
Follow-up to #2095, from @dmpetrov's review (point 5):
open_objecthad two options for one setting.block_size(#2028) sets the read-ahead block, andread_ahead=False(#2095) turned read-ahead off.Change:
block_size=0now turns read-ahead off, andread_aheadis gone. Each read then fetches only the bytes asked for.Nonestill means the filesystem default (50 MiB on S3), and a positive value sets the block size.0intocache_type="none"and doesn't passblock_size=0to fsspec. Filesystems treat 0 differently:HfFileSystemopens a stream that can't seek, which breaks pyarrow on the Parquet footer._PartialReadHandlerpassesblock_size=0, which gives fsspec the same arguments asread_ahead=Falsedid.File.open(block_size=0)already forwarded toopen_object. The docstring now mentions 0.block_size, as before.Tests:
test_open_object_huggingface_block_size_zero_reads_only_asked_bytesseeks and fetches only the asked range. It fails on main withCannot seek streaming HF file.hf_archive_clientfixture shared with the tar read-ahead test.🤖 Generated with Claude Code