Skip to content

compute: columnar FlatMap input, fueling preserved - #37758

Open
antiguru wants to merge 2 commits into
columnar-f1-consolidatefrom
columnar-c2-flatmap-input
Open

compute: columnar FlatMap input, fueling preserved#37758
antiguru wants to merge 2 commits into
columnar-f1-consolidatefrom
columnar-c2-flatmap-input

Conversation

@antiguru

@antiguru antiguru commented Jul 20, 2026

Copy link
Copy Markdown
Member

FlatMap reads its input from the columnar edge, preserving the existing fuel and backpressure behavior through a generic fueled stage operator.

Columnar dataflow-edge migration. Design doc: doc/developer/design/20260720_columnar_dataflow_edges.md (#37744).

Part of CPU-51.

@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from d6e8fb1 to 2500faf Compare July 22, 2026 08:41
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

CPU-51

@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from 2500faf to 88a16d7 Compare July 22, 2026 16:24
@antiguru antiguru changed the title compute: columnar FlatMap input, fueling preserved (C2) compute: columnar FlatMap input, fueling preserved Jul 22, 2026
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from 88a16d7 to 33792e0 Compare July 22, 2026 17:50
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from 33792e0 to 67ec14d Compare August 19, 2026 12:01
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch 3 times, most recently from bebbdd0 to da910b5 Compare August 20, 2026 09:13
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from da910b5 to 7f2ef79 Compare September 6, 2026 18:23
@antiguru
antiguru marked this pull request as ready for review September 10, 2026 11:24
@antiguru
antiguru requested a review from a team as a code owner September 10, 2026 11:24
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from 7f2ef79 to 0b95961 Compare September 10, 2026 11:33
antiguru and others added 2 commits September 10, 2026 14:07
Rework `render_flat_map` so the bespoke `FlatMapStage` consumes the input
`CollectionEdge` directly instead of decoding it via `as_specific_collection`
(which forces `into_vec`). The unarranged path reads the edge, so the columnar
arm never decodes rows at the input; the keyed path still reads an existing
arrangement, already columnar internally, presented as a `Vec` edge.

The fuel machinery is the point of this operator: it bounds how much work a
single `generate_series` can do before yielding the worker. To keep the `Vec`
and columnar arms from drifting, the fuel queue, per-activation budget, and
re-activation now live in one generic `flat_map_stage` function. The only
arm-specific piece is how records are read from a queued batch, factored into a
small `FlatMapBatch` trait: the `Vec` arm drains owned rows, the columnar arm
iterates the borrowed column via `into_index_iter` and never materializes an
owned `Row`. The per-record table-function expansion and mfp drain are shared
in `process_flat_map_row`. FlatMap is explicitly not routed through
`flat_map_datums`, which drains a full batch with no fuel budget.

Producers still emit `Vec`, so the columnar arm is dead in production and this
carries no runtime change.

Two unit tests: `flat_map_fuel_bounds_per_activation` proves a small fuel
budget spreads a multi-batch input across multiple activations while an
unbounded budget drains it in one, and `flat_map_arms_agree` proves the `Vec`
and columnar arms produce identical output across multiple timestamps including
a retraction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A per-record `inspect` needs `&Container: IntoIterator`, and on macOS resolving
that recurses through `objc2`'s blanket impls until the trait solver overflows,
so `lint-macos` fails to compile the test. Counting through the container avoids
the resolution entirely.

The same test reads the container directly from the commit that makes FlatMap's
output columnar onward, so this only closes the window where it did not.
@antiguru
antiguru force-pushed the columnar-c2-flatmap-input branch from 0b95961 to 14da798 Compare September 10, 2026 12:09
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