Skip to content

Fix/streaming bulk reads - #2

Open
ryandamour wants to merge 2 commits into
mainfrom
fix/streaming-bulk-reads
Open

ryandamour wants to merge 2 commits into
mainfrom
fix/streaming-bulk-reads

Conversation

@ryandamour

Copy link
Copy Markdown
Collaborator

No description provided.

ryandamour and others added 2 commits October 4, 2026 05:55
A filtered get() read the entire cached export into memory and filtered
afterwards, and Arrow's allocator kept the freed memory, so a worker
backfilling a large non-templated export (liquid_universe_prices) window by
window ratcheted up until it was OOM-killed.

- Push start/end/symbols into a batch-by-batch pyarrow.dataset scan for
  feather (Arrow IPC) and parquet exports; memory now scales with the rows
  returned. Feather V1 (FX per-pair exports) and unsupported column types
  fall back to the previous full-read-then-filter path.
- Return freed Arrow memory to the OS after every read.

Year-by-year loop over a 5.26M-row synthetic export: peak RSS 1,224 MB ->
604 MB, identical rows.

Tests pin the memory bound (metered Arrow pool, with an unfiltered control),
that filtered reads never load a whole export, result equivalence with the
old path across formats and column types, the V1 fallback, memory release,
and that results are never shared between get() calls (live seam values
must not leak into later bulk reads; mutating a result must not affect the
next one) -- the two failure modes of an in-memory frame cache.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The scanner's background read-ahead can release buffers to the test's
proxy pool after to_table() returns. When the pool was destroyed first,
a later, unrelated test crashed the interpreter (about 1 run in 10).
Keep the metered pools for the life of the process. The library is not
affected: it always uses Arrow's process-wide default pool.

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

This branch has not been deployed

No deployments
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.

1 participant