Skip to content

perf(core): carry source-info tokens as a recipe until their text is needed (ITL-1464) - #563

Closed
eywalker wants to merge 3 commits into
mainfrom
eywalker/itl-1464-tokens
Closed

eywalker wants to merge 3 commits into
mainfrom
eywalker/itl-1464-tokens

Conversation

@eywalker

@eywalker eywalker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Draft, step 1 of the token track of ITL-1464 (mentions ITL-1464; the issue stays open). Stack: this, #564 (joins), #568 (aggregations).

What

A source row's token <source id>::<record id>::<column> is in its two system tags and the column name. Inside the library a _source_x column is now carried as a recipe: an internal Arrow extension column with no bytes, which filter, take, rename and concat carry like any other. Text is made in one function (source_tokens.materialize), when it is shown, stored, hashed or given to a function. Design, with every producer and consumer: docs/dev/specs/itl-1464-tokens.md.

The read that keeps recipes is a private library function (core/streams/carried.py), no part of a stream's interface. It holds only for a stream whose own class declares it and that reads as that class, and for an operator whose own class declares it: a subclass, a replaced as_table, a user's stream and a user's operator (also over a library one) read and give text. Reading, casting, hashing (schemas and zero-row tables too), pickling, storing and Parquet writing a recipe column each raise.

Review findings -> tests

Finding (independent review) Test
A recipe reachable through the stream protocol, stored and hashed test_the_carried_read_is_no_part_of_a_stream, test_a_store_refuses_a_derived_column, test_a_derived_column_that_leaks_is_an_error
A subclass's own as_table bypassed test_a_stream_with_its_own_read_is_read_through_it
A stream without the new method fails test_a_stream_without_the_internal_read_is_read_as_before
(found on the way) a user's subclass of a library operator test_a_subclass_of_a_library_operator_reads_text

Measured

Synthetic time series table, about 2.2 million rows, 13 columns, about 250 MiB of Arrow data.

Step Peak RSS before after
as_table(), run() 10.8 GiB 2.0 GiB
map_data 10.8 GiB 2.0 GiB
drop_nulls 19.7 GiB 2.4 GiB
polars_filter 16.6 GiB 2.5 GiB

Tests

tests/test_core/streams/test_source_tokens.py: every operator case of the sync/async corpus equals the same operation over sources whose tokens are text (schema, bits, rows, hashes); every public read gives no recipe column; predicates that may read tokens get text; stored rows equal; a spilled table keeps its recipes. Run locally: source, stream, operator, hashing, database and utility tests, golden --check (no value moved), ruff, whole-repository basedpyright (0 errors).

The ITL-1347 differential (both fixtures, all modes, both orchestrators, one and default Polars threads), run on the head of the stack (#568) against main: sync equals main byte for byte, async equals main's async as sets, 32 of 32; async against sync differs exactly as it does on main.

🤖 Generated with Claude Code

eywalker and others added 2 commits November 25, 2026 01:24
…needed (ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.68421% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/orcapod/utils/source_tokens.py 97.80% 2 Missing ⚠️
src/orcapod/core/operators/filters.py 94.44% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/orcapod/core/operators/add_tags.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/column_selection.py 99.35% <100.00%> (+0.01%) ⬆️
src/orcapod/core/operators/drop_nulls.py 99.01% <100.00%> (+<0.01%) ⬆️
src/orcapod/core/operators/filter.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/mappers.py 99.35% <100.00%> (+<0.01%) ⬆️
src/orcapod/core/operators/meta_columns.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/static_output_pod.py 95.48% <100.00%> (-0.67%) ⬇️
src/orcapod/core/operators/tag_by.py 98.66% <100.00%> (+0.01%) ⬆️
src/orcapod/core/sources/arrow_table_source.py 100.00% <100.00%> (ø)
src/orcapod/core/sources/base.py 99.39% <100.00%> (+0.01%) ⬆️
... and 21 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…efuse recipes (ITL-1464)

Review of PRs 563 and 564.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eywalker

eywalker commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing as part of the ITL-1464 draft group. The async-route work continues as ITL-1347 stage 5 (ITL-1845). The SpiralDB read work landed in #687 and #679, and continues in #683.

Posted by a Claude Code agent on behalf of @eywalker.

@eywalker eywalker closed this Dec 2, 2026
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