Skip to content

perf(operators): async joins index their smaller input; channels carry derived tokens (ITL-1464) - #567

Closed
eywalker wants to merge 33 commits into
mainfrom
eywalker/itl-1464-joins-derived
Closed

eywalker wants to merge 33 commits into
mainfrom
eywalker/itl-1464-joins-derived

Conversation

@eywalker

@eywalker eywalker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Draft, a step of ITL-1464 (the issue stays open). Stacked on #563, #564 and #565 (and so #559). It also carries the fixes of #565's second review, because it rewrites that code: review the joins at this head.

What this does

  • An async join indexes its smaller input only. Unless both inputs are certified unique on the keys (1:1, matched and let go as they arrive), rows are spooled without keys until the smaller side is known, which is then indexed; the other side's rows are replayed against it. Nothing is ever held back, so no graph can deadlock on it. The cost: such a step gives no row before one input has ended (and, when that one is large, before the other has delivered as many rows or ended), and each input's rows are written to local disk at most once.
  • SemiJoin holds the right input's distinct keys only. Rejoin of two inputs streams; three or more stay a barrier.
  • Derived source-info tokens travel between the library's operators over channels, and cost a held row nothing. Every public read of a channel gives text.

The sync path is unchanged. No hash, identity, stored layout or golden value moves (golden --check clean). No job node calls this form yet.

Measured (the operator alone, 8,000,000 synthetic rows; peak RSS, 143 MiB of it imports)

Case #565 This
lookup, small side first 257 MiB, 19.9 s 221 MiB, 21.3 s
lookup, small side last 2,733 MiB, 61.7 s 481 MiB, 21.0 s (1,480 MiB on disk)
many to many, both open (40,000,000 out) 2,629 MiB, 57.3 s 1,793 MiB, 62.4 s (2,528 MiB on disk)
1:1, one input entirely first 2,301 MiB, 60.0 s 2,456 MiB, 64.6 s (1,480 MiB on disk)
1:1, in step 341 MiB, 39.3 s 262 MiB, 39.2 s
semi-join, right input last not run 477 MiB, 19.6 s
rejoin, two branches in step not run 320 MiB, 51.9 s

Still linear in one input's keys: many to many with both open, and 1:1 with one input entirely first. docs/dev/specs/itl-1464-joins.md.

Review findings -> tests

Finding Test
#565 round 2: one old row pinned the row mask test_one_old_row_does_not_pin_what_later_rows_cost
#565 round 2: a structural stream of the previous protocol is refused accepted: protocols are internal; stated in the spec
#567: a public batch read gave a recipe test_a_public_read_of_a_channel_gives_text
#567: mixed text and derived batches failed when staged test_batches_of_both_forms_however_they_arrive, test_a_producer_that_changes_a_tokens_form
#567: a stream's own reader was bypassed test_a_channel_reads_a_stream_through_its_own_reader

Also: which side is indexed (test_a_join_holds_the_keys_of_its_smaller_side_whichever_ends_first, test_an_ended_side_is_indexed_once_the_other_has_as_many_rows), endless inputs, cancellation while replaying, disk released while replaying, logical types, two-input Rejoin. Some existing kernel tests now expect a row or a value-decided refusal when an input ends, where it used to come with its batch.

Round 2

Finding Test
Alternating text and derived batches kept a spool each in memory test_alternating_token_forms_keep_one_memory_limit, test_rows_are_written_when_asked
The channel's own protocol offered the internal form test_no_read_of_a_channel_gives_a_recipe, test_a_channel_of_a_users_class_is_read_through_its_own_reads
A replay whose sends never wait gave no other task a turn test_a_replay_whose_sends_never_wait_can_be_cancelled
Two-input Rejoin over channels matches raw streams of several data contexts differently from sync declined: not new. The reviewer's probe gives the same on main, whose barrier also reads channels, and channels carry no per-row context (ITL-1347; ITL-1359 owns it). test_rejoin_over_channels_equals_its_barrier_for_rows_of_several_contexts pins that the two forms agree

Round 3

Finding Test
A join over a shared data-tag raised when an input changed its token form, derived first test_shared_data_tags_when_a_tokens_form_changes, test_shared_data_tags_whose_tokens_change_form_over_staged_channels

Both orders of the change, every kernel, kernel and channels; 26 of the 100 cases fail on the previous head.

Certificates over whole graphs: test_certificate_graphs.py runs random graphs on sync, on channels, and on channels with certificates ignored, compares the rows, and checks every stream's certificate on its rows. With every side certified by force, the same test sees rows lost.

Mentions ITL-1464.

🤖 Generated with Claude Code

eywalker and others added 21 commits November 25, 2026 01:20
…isk (ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ws, with bounded output batches (ITL-1464)

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…geJoin and SemiJoin streaming on record-batch channels (ITL-1464)

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

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

A forked child neither waits for a lock of its parent's threads nor touches its parent's
files; a failed spill leaves the spool as it was; an unlocked or partly removed directory is
swept. table() and slice() give rows through their mappings and outlive the spool.

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n's row mask is bounded by the rows held (ITL-1464)

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

Review of PRs 563 and 564.

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

eywalker and others added 5 commits November 25, 2026 02:19
…-joins

Joins read through _input_table too (review of PR 564).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…put Rejoin streams; channels give text to public reads (ITL-1464)

Review of #565 and #567: a held row costs what is held, whatever was held before it; a
channel's public read gives text and reads a stream through its own reader; batches may mix
text and derived tokens however they arrive.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eywalker eywalker changed the title perf(operators): async joins and channels carry derived source-info tokens (ITL-1464) perf(operators): async joins index their smaller input; channels carry derived tokens (ITL-1464) Nov 25, 2026
eywalker and others added 2 commits November 25, 2026 03:18
…ld before them (ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eywalker and others added 2 commits November 25, 2026 03:20
… key row (ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eywalker and others added 2 commits November 25, 2026 03:31
…ITL-1464)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a channel's protocol, a turn for other tasks between batches (ITL-1464)

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

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.12030% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/orcapod/core/row_spool.py 97.00% 9 Missing ⚠️
src/orcapod/core/operators/streaming_joins.py 99.01% 4 Missing ⚠️
src/orcapod/side_effects.py 76.92% 3 Missing ⚠️
src/orcapod/core/cached_function_pod.py 80.00% 1 Missing ⚠️
src/orcapod/core/exact_class.py 94.11% 1 Missing ⚠️
src/orcapod/core/nodes/function_node.py 85.71% 1 Missing ⚠️
src/orcapod/core/operators/filters.py 95.23% 1 Missing ⚠️
src/orcapod/core/operators/index.py 66.66% 1 Missing ⚠️
src/orcapod/core/operators/pick.py 66.66% 1 Missing ⚠️
src/orcapod/core/operators/static_output_pod.py 97.82% 1 Missing ⚠️
... and 2 more
Files with missing lines Coverage Δ
src/orcapod/core/function_pod.py 96.63% <100.00%> (+0.03%) ⬆️
src/orcapod/core/nodes/operator_node.py 95.89% <100.00%> (+0.04%) ⬆️
src/orcapod/core/nodes/source_node.py 95.93% <100.00%> (+0.05%) ⬆️
src/orcapod/core/operators/add_tags.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/batch.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/column_selection.py 99.38% <100.00%> (+0.03%) ⬆️
src/orcapod/core/operators/drop_nulls.py 99.04% <100.00%> (+0.03%) ⬆️
src/orcapod/core/operators/filter.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/group_by.py 100.00% <100.00%> (ø)
src/orcapod/core/operators/join.py 98.66% <100.00%> (+0.09%) ⬆️
... and 41 more

... and 5 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.

…r their column is called (ITL-1464)

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