Skip to content

compute: plan the sink source arrangement key#37444

Draft
antiguru wants to merge 1 commit into
MaterializeInc:mainfrom
antiguru:sink-planned-from-key
Draft

compute: plan the sink source arrangement key#37444
antiguru wants to merge 1 commit into
MaterializeInc:mainfrom
antiguru:sink-planned-from-key

Conversation

@antiguru

@antiguru antiguru commented Jul 4, 2026

Copy link
Copy Markdown
Member

When a sink consumes an arranged from collection, the renderer previously picked an arrangement key arbitrarily (bundle.arranged.iter().next()) at runtime and derived the unthinning permutation there. That key choice is a planning decision, so this moves it to LIR lowering.

ComputeSinkDesc gains from_key: Option<Vec<LirScalarExpr>>. Lowering sets it from the available arrangements of from: None selects the unarranged collection, Some(key) names an arrangement the renderer reconstructs full rows from. The permutation and thinning stay derived at render time, since they are a pure function of the key.

Behavior is unchanged: when raw is available lowering picks None, matching the old collection-preference; otherwise it names the same key set the renderer builds. The former arbitrary-pick fallback becomes a planned lookup.

Retires the TODO[btv] in render/sinks.rs.

Draft: not yet exercised end-to-end against subscribe/MV/copy-to sink dataflows.

🤖 Generated with Claude Code

Sinks that consume an arranged `from` collection previously chose an
arrangement key arbitrarily at render time and derived the unthinning
permutation there. Record the chosen key on `ComputeSinkDesc.from_key`
during LIR lowering, where the available arrangements of `from` are
known, and have the renderer consume it. `None` selects the unarranged
collection.

The permutation and thinning stay derived at render time, since they are
a pure function of the key.

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.

1 participant