Skip to content

Add Store.getRanges for reading many byte ranges of one value - #108

Open
konstibob wants to merge 1 commit into
zarr-developers:mainfrom
konstibob:feat/read_bulk
Open

konstibob wants to merge 1 commit into
zarr-developers:mainfrom
konstibob:feat/read_bulk

Conversation

@konstibob

Copy link
Copy Markdown
Contributor

First building block for readBulk (#99): reading many regions efficiently needs a way to fetch many byte ranges of one shard without paying one request per range.

  • Store.getRanges(keys, starts, ends[, maxGapBytes, maxCoalescedBytes]) is a default method, so every store supports it.

  • It coalesces nearby ranges into one get(keys, start, end) per group and slices the result back into per-range buffers, returned in input order (null if the key is missing).

  • FilesystemStore overrides getRanges to open the file once and read each range directly; coalescing buys nothing locally.

First building block for readBulk (zarr-developers#99): reading
many regions efficiently needs a way to fetch many byte ranges of one
shard without paying one request per range.

- Store.getRanges(keys, starts, ends[, maxGapBytes, maxCoalescedBytes]) is a
  default method, so every store supports it. It coalesces nearby ranges
  into one get(keys, start, end) per group and slices the result back into
  per-range buffers, returned in input order (null if the key is missing).
  Limits default to 1 MiB gap / 16 MiB per fetch, as in zarr-python's
  Store.get_ranges.
- ByteRangeCoalescer ports zarr-python's coalesce_ranges.
- FilesystemStore overrides getRanges to open the file once and read each
  range directly; coalescing buys nothing locally.

Nothing calls getRanges yet; switching the sharding codec over and adding
readBulk follow separately.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants