Skip to content

Separate chunker from batcher#625

Open
antiguru wants to merge 1 commit intoTimelyDataflow:master-nextfrom
antiguru:explicit_chunker
Open

Separate chunker from batcher#625
antiguru wants to merge 1 commit intoTimelyDataflow:master-nextfrom
antiguru:explicit_chunker

Conversation

@antiguru
Copy link
Copy Markdown
Member

@antiguru antiguru commented Jul 15, 2025

The chunker was part of the batcher and responsible for transforming input data into the batcher's chain format. Hence, the batcher needed to be aware of its input types, although it would not otherwise use this information.

This change drops the Input and C type parameters from MergeBatcher, and the Input associated type plus push_container method from the Batcher trait. Batchers now accept chunks via PushInto<Self::Output>. Chunking moves into arrange_core, which gains a Chu: ContainerBuilder type parameter so callers can supply a chunker that maps the stream's input container into the batcher's output container.

The Arrange trait constrains Ba::Output = C (same-type chunker) and hardcodes ContainerChunker<C> internally, so .arrange::<Ba, Bu, Tr>() callsites for Vec-based collections are unchanged. Callers that need a cross-container chunker (columnar layouts, interactive) drop to arrange_core directly.

Also updates chainless_batcher::Batcher to the new Batcher trait shape.

The chunker was part of the batcher and responsible for transforming input
data into the batcher's chain format. Hence, the batcher needed to be aware
of its input types, although it would not otherwise use this information.

Drop the `Input` and `C` type parameters from `MergeBatcher`, and the
`Input` associated type plus `push_container` method from the `Batcher`
trait. Batchers now accept chunks via `PushInto<Self::Output>`. Chunking
moves into `arrange_core`, which gains a `Chu: ContainerBuilder` type
parameter so callers can supply a chunker that maps the stream's input
container into the batcher's output container.

The `Arrange` trait constrains `Ba::Output = C` (same-type chunker) and
hardcodes `ContainerChunker<C>` internally, so `.arrange::<Ba, Bu, Tr>()`
callsites for `Vec`-based collections are unchanged. Callers that need a
cross-container chunker (columnar layouts, interactive) drop to
`arrange_core` directly.

Also updates `chainless_batcher::Batcher` to the new `Batcher` trait
shape, and replaces `batcher.push_container(&mut vec\![..])` with
`batcher.push_into(vec\![..])` in the trace test.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
@antiguru antiguru changed the base branch from master to master-next April 17, 2026 14:45
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