Row-shape contract: shape='map' proves exactly-one-row-per-row at build time (TASK-58) - #44
Merged
Merged
Conversation
… 'many' (TASK-58) User-requested serving fence ahead of stage B: shape='map' statically PROVES exactly one output row per input row (out[i] <-> in[i]) at build time — rejects WHERE, INNER joins (key misses drop), and static-only constant queries, each named; LEFT joins and scalar projections serve (unique keys are already the map contract). shape='filter' (default) is byte-identical to before; shape='many' is reserved and will be the ONLY shape under which stage-B multiplicity constructs build. Introspectable via fn.shape. Doc note in known-limitations §2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ahrzb
approved these changes
Jul 28, 2026
ahrzb
approved these changes
Jul 28, 2026
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.
The serving fence, ahead of stage B
DuckDBInferFn(..., shape=...)declares the row-count contract, checked statically at build:"filter"(default)"map"out[i] <-> in[i]"many"The proof is static (query shape), not a runtime row-count check — downstream code can rely on positional correspondence. When stage B lands, duplicate-key / cross / inequality / self-joins will build only under
shape='many', so multiplicity can never sneak into a serving path by default.Gate: cargo 163, pytest 613 + 13 xfail, corpus 529 unchanged. New
fn.shapegetter; matrix in tests/test_shape_contract.py; doc note in known-limitations §2.🤖 Generated with Claude Code