compute: columnar FlatMap input, fueling preserved (C2)#37758
Draft
antiguru wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rework
render_flat_mapso the bespokeFlatMapStageconsumes the inputCollectionEdgedirectly instead of decoding viaas_specific_collection(which forcesinto_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
Vecedge.The fuel machinery is the point of this operator: it bounds how much work a single
generate_seriescan do before yielding the worker.To keep the
Vecand columnar arms from drifting, the fuel queue, per-activation budget, and re-activation now live in one genericflat_map_stage.The only arm-specific piece is reading records from a queued batch, factored into a small
FlatMapBatchtrait: theVecarm drains owned rows, the columnar arm iterates the borrowed column viainto_index_iterand never materializes an ownedRow.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.Tests:
flat_map_fuel_bounds_per_activationproves a small fuel budget spreads a multi-batch input across multiple activations while an unbounded budget drains it in one;flat_map_arms_agreeproves the two arms produce identical output across multiple timestamps including a retraction.