Skip to content

Keep a data-frame transform's collect off the request worker - #855

Open
CleanCut wants to merge 1 commit into
mainfrom
cleancut/transform-collect-offload
Open

Keep a data-frame transform's collect off the request worker#855
CleanCut wants to merge 1 commit into
mainfrom
cleancut/transform-collect-offload

Conversation

@CleanCut

Copy link
Copy Markdown
Contributor

Move sync work into a thread so it doesn't block the async request worker.

ENG-1432

`tabular::transform` ends in an eager, frame-sized polars collect that ran on whatever runtime called
it. Fourteen production call sites await it, several of them inside HTTP handlers, so a request worker
sat through the whole collect and picked up nothing else while it ran.

The collect now runs inside `spawn_blocking`, matching the closure `add_row` already uses. The
signature is unchanged, so no call site moves.

`transform_lazy`, a few lines below, documents the rule this was missing: eager polars work belongs
inside `spawn_blocking`. Its own filter and take branches honor it, as do `add_col_lazy` and
`add_row`; this tail was the one link without an offload. Only the tail moves — `transform_lazy` stays
async because its vstack and sql branches await, and flattening those is a larger change.

No benchmark accompanies this. The frame is already materialized, so the cost being removed is worker
occupancy, not a crash risk.

ENG-1432
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 93c99314-b43a-46a4-910e-5500bcebcf58

📥 Commits

Reviewing files that changed from the base of the PR and between ebab2cc and 6c1c9a4.

📒 Files selected for processing (1)
  • crates/liboxen/src/core/df/tabular.rs

📝 Walkthrough

Summary by CodeRabbit

  • Performance
    • Improved responsiveness during tabular data transformations by moving intensive processing off the asynchronous runtime.
  • Bug Fixes
    • Improved error handling when finalizing and collecting transformed data.

Walkthrough

transform now performs the final lazy slice transformation and collection in task::spawn_blocking. It awaits the blocking task and propagates task and collection errors.

Changes

Tabular transformation execution

Layer / File(s) Summary
Blocking lazy collection
crates/liboxen/src/core/df/tabular.rs
transform executes lazy collection in a blocking task and awaits the result instead of collecting directly on the async runtime.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • Oxen-AI/Oxen#602: Both changes update tabular.rs to run transform collection through spawn_blocking and propagate errors.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes moving data-frame transformation collection off the request worker.
Description check ✅ Passed The description accurately explains moving synchronous work to a thread and references the related issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleancut/transform-collect-offload

Comment @coderabbitai help to get the list of available commands.

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