Skip to content

Add production Lance inference and async transform primitives - #259

Merged
Hynek Kydlíček (hynky1999) merged 23 commits into
mainfrom
codex/lance-add-columns-fill
Aug 31, 2026
Merged

Hynek Kydlíček (hynky1999) merged 23 commits into
mainfrom
codex/lance-add-columns-fill

Conversation

@hynky1999

@hynky1999 Hynek Kydlíček (hynky1999) commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This consolidates the Refiner primitives needed by the production hand-feature pipeline:

  • add bounded Lance reads with the single max_rows name
  • add AddColumns(fill=...) for row-aligned partial Lance column updates, including bounded/filtered sources and retry-stable untouched-fragment synthesis
  • add worker-local transform factories so expensive model state initializes once per worker
  • add bounded asynchronous batch transforms for overlapping CPU preparation, serialized GPU inference, and downstream work without making the whole engine async
  • coalesce complete references to the same packed blob and normalize distributed Lance-writer schemas
  • allow dynamic row-map field removal and fix blob-reference type narrowing
  • document each public primitive and its intended bounded-inference usage

The intentionally unsafe attempted overlap of packed-blob reads/uploads remains reverted.

Validation

  • Full CI: passing
  • CodeQL: passing
  • Local suite previously: 1204 passed, 22 skipped
  • Dedicated coverage added for:
    • bounded/filtered filled Lance updates
    • worker-local stateful factories
    • bounded async batch ordering, backpressure, and failure propagation
    • Lance source max_rows behavior

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T22:39:50.796446Z 107e302 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2340441281

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +1663 to +1668
) = self._fill_add_columns_fragments(
lance,
source_fragment_ids,
output_schema,
lance_schema,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clean generated fill files before rejecting the commit

When the destination advances beyond source_version before the reducer runs, this call writes fill-only Lance files for every omitted fragment, but the version check later raises before reaching the commit try/cleanup block. Because these reducer-created paths are not persisted in worker sidecars, subsequent retries cannot discover them, leaving potentially dataset-sized orphan files; validate the current version before filling or cover all post-fill validation failures with cleanup.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fa0a0eda8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

batch_size: int = 65_536,
num_shards: int | None = None,
row_limit: int | None = None,
max_rows: int | None = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve AddColumns fill when max_rows is zero

With load_lance(..., max_rows=0) on a nonempty dataset followed by write_lance_dataset(..., mode=AddColumns()), the source plans no shards, so the writer stage emits no sidecar containing the planned output schema. The reducer consequently takes the no-metadata path and rejects the operation as missing every fragment instead of filling every omitted row, even though zero is explicitly permitted here and bounded AddColumns is intended to fill omitted rows.

Useful? React with 👍 / 👎.

Comment thread src/refiner/pipeline/pipeline.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6578e32e6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/refiner/platform/manifest.py Outdated
Comment thread docs/writing-data/lance.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af3361b7b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/refiner/pipeline/sinks/lance.py Outdated
Comment thread src/refiner/pipeline/pipeline.py
@hynky1999 Hynek Kydlíček (hynky1999) changed the title Support filled partial Lance column updates Add production Lance inference and async transform primitives Aug 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbfb15f488

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/refiner/pipeline/sinks/assets.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0ddb4ea11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +122 to +124
`batch_map_async` processes multiple batches concurrently. Use
`max_in_flight` to bound concurrency and `preserve_order` when output order
must match input order:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required peer-system execution-model comparison

This section introduces a new bounded async-batch scheduling model alongside worker-local factory lifetimes, but it documents only the API mechanics. Add an ending ## Internal Notes section comparing this approach with Spark, Beam/Dataflow, Daft, Hugging Face Datasets, and Ray/Ray Data, and justify why Refiner uses per-worker async windows and factories instead of those systems’ batch, actor, or stage primitives; otherwise this execution-model decision omits the repository-required architectural tradeoff analysis.

AGENTS.md reference: AGENTS.md:L47-L47

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcc4d83075

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/refiner/pipeline/pipeline.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce7c036992

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/refiner/pipeline/sinks/lance.py
@hynky1999
Hynek Kydlíček (hynky1999) merged commit b028e8f into main Aug 31, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 107e302860

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +146 to +148
dtypes = getattr(step, "dtypes", None)
if dtypes:
columns.update(dtypes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop stale dtype constraints after later undeclared maps

When one row transform declares dtypes={"value": int64()} and a later map, map_async, batch_map, or flat_map replaces value without declaring a dtype, this set retains the earlier constraint, so the Lance sink casts the final runtime strings back to integers or rejects them. Although the source-schema case is now covered, this new helper is fresh evidence that the same dynamic-map behavior still fails whenever the planned type originated in an earlier transform; only constraints applicable to the final producer of a column should be enforced.

Useful? React with 👍 / 👎.

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