Skip to content

join_traces uses timely's container builder - #478

Merged
antiguru merged 8 commits into
TimelyDataflow:masterfrom
antiguru:join_traces_no_iterator
Apr 30, 2024
Merged

join_traces uses timely's container builder#478
antiguru merged 8 commits into
TimelyDataflow:masterfrom
antiguru:join_traces_no_iterator

Conversation

@antiguru

@antiguru antiguru commented Apr 25, 2024

Copy link
Copy Markdown
Member

Switch join_traces to use timely's container builder, and add a container builder that consolidates in-place.

Demonstrate how `join_traces` could look like if the closure was to use
internal instead of external iteration. This fails tests because the join's
output is no more consolidated, which is the big gap of this change, and
makes it a non-starter unless we have an alternative.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
@antiguru
antiguru marked this pull request as ready for review April 30, 2024 21:19
@antiguru antiguru changed the title Example for join_traces with internal iteration join_traces uses timely's container builder Apr 30, 2024
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
@frankmcsherry
frankmcsherry self-requested a review April 30, 2024 21:25

@frankmcsherry frankmcsherry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@antiguru
antiguru merged commit 1eb052c into TimelyDataflow:master Apr 30, 2024
@antiguru
antiguru deleted the join_traces_no_iterator branch April 30, 2024 21:30
This was referenced Oct 29, 2024
frankmcsherry added a commit that referenced this pull request Jul 8, 2026
* join: reshape JoinTactic to an iterator of output containers

Replace the two-method JoinTactic (defer + fuel-metered work) with a single
`prep(input0, input1, fresh, meet) -> Box<dyn Iterator<Item = CB::Container>>`.

The tactic now maps two batch lists to an iterator of output containers and
holds neither capabilities nor a fuel budget, mirroring ReduceTactic's
data-to-data division of labor. The driver owns the two per-direction queues,
pairs each iterator with its shipping capability, pulls under a split fuel
budget, ships each yielded container, and drops a unit when its iterator goes
dry. "Work remains" becomes driver-observable (an iterator has yet to yield
None) rather than a fuel-sign protocol the tactic must self-report.

Join closures now push into a bare `&mut EffortBuilder<CB>` rather than a
timely `JoinSession`. The session is bound to a live operator output and is
not locally constructible, so it could not back a self-contained iterator;
the arbitrary-container capability #478 wanted comes from the ContainerBuilder,
not the session, so a bare builder suffices. `JoinSession` is removed.

The cursor tactic shares its logic closure across units via Rc<RefCell<_>>
(each unit is a 'static iterator and cannot borrow the tactic), preserving the
single-mutable-state semantics of one closure threaded through every match.
Deferred becomes DeferredIter: next() plays the same merge-join loop forward,
suspending at container boundaries instead of under a fuel budget.

Open for review:
- EffortBuilder's record counter is now vestigial; the type reduces to a bare
  give-providing sink, or could be removed for push_into on CB directly.
- DeferredIter::next uses mem::take on extract (needs Container: Default),
  stealing the builder's recycled allocation; a stash-swap would avoid it.
- logic's public sink type changed (JoinSession -> EffortBuilder<CB>); Mz
  exposure unverified.

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

* join: remove the now-vestigial EffortBuilder

Its only remaining job was renaming `push_into` to `give`; the record counter
that justified the wrapper went dead when the driver began metering fuel from
shipped containers' `record_count()`. Join closures now receive `&mut CB` and
call `push_into` directly. `EffortBuilder` is deleted.

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

* join: fix the columnar example's join sink caller

The reachability example pushed into the join sink via `session.give(..)`, an
inherent method on the removed `EffortBuilder`. The sink is now `&mut CB`, so it
calls `push_into` directly and imports `timely::container::PushInto` in the
`reachability` module (the old inherent `give` needed no trait in scope).

Only surfaces under `--all-targets`, which is why `cargo build --workspace`
missed it but CI did not.

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

* Tidy some structure

* join: parameterize JoinTactic by its output container, not the builder

The trait used `CB` only as `CB::Container` (the iterator's Item); it never
constructs or pushes into a builder. Parameterizing by the container `C`
instead keeps the builder where it is actually used — a private concern of the
cursor tactic, which now carries it as `CursorTactic<B0, B1, L, CB>` and
implements `JoinTactic<B0, B1, CB::Container>`.

Two things fall out. The `Container: Default` bound (needed only for the cursor
tactic's `mem::take`) leaves the trait for that impl. And the driver, which
only ships finished containers via `give_container`, no longer needs the
caller's builder: it pins the operator output to `NoopBuilder<C>` (a builder
for any `C`, no bounds) and requires only `C: Container`. This is the groundwork
for tactics that produce containers without a push-builder (proxy `cross`,
columnar bulk), which would otherwise carry a builder they never use.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants