Skip to content

Expand a joined record type into a Cascades graph - #4741

Merged
g31pranjal merged 5 commits into
mainfrom
apple/g31pranjal/joined-record-type-expansion
Nov 3, 2026
Merged

g31pranjal merged 5 commits into
mainfrom
apple/g31pranjal/joined-record-type-expansion

Conversation

@g31pranjal

@g31pranjal g31pranjal commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Implements SyntheticRecordType.expand for JoinedRecordType, which until now threw. #4626 added expand and implemented it for UnnestedRecordType; this does the same for joins.

A joined record type expands to one scan per constituent and one equality predicate per join:

  • Each constituent is the expansion of its stored record type, a type-filtered scan, flowed whole as a result column named after the constituent. A type joined to itself gets one scan per copy, each with its own quantifier, so the join can relate the copies.
  • Each join becomes left = right, with each side's key expression translated into a value over its own constituent's quantifier. Nested join fields become nested field values.
  • A constituent with no join leaves the pair unconstrained, which is the same cross product the joined record type itself produces.

Outer-joined constituents are rejected with UnsupportedOperationException. An outer join keeps a record that has no partner, and an inner equality between two scans would drop it.

This is groundwork: nothing calls expand yet. It is what lets an index on a joined record type become a match candidate, so that a query performing the same join by hand can be answered from the index.

UnnestedRecordTypeExpansionTest is renamed to SyntheticRecordTypeExpansionTest, which now tests the expansion of both kinds of synthetic type. Its test expecting a joined type to throw is replaced by tests of a two-way join, a self-join, a three-way cyclic join (one equality per join), a join whose constituents are named in the opposite order to their declaration, a nested join field, a constituent with no join, and outer-join rejection.

@g31pranjal g31pranjal added the enhancement New feature or request label Oct 13, 2026
@g31pranjal
g31pranjal force-pushed the apple/g31pranjal/joined-record-type-expansion branch from ba7a7c9 to a6cc49d Compare November 2, 2026 00:01
@g31pranjal
g31pranjal marked this pull request as ready for review November 2, 2026 10:35
@g31pranjal
g31pranjal merged commit 4f88af0 into main Nov 3, 2026
14 checks passed
@g31pranjal
g31pranjal deleted the apple/g31pranjal/joined-record-type-expansion branch November 3, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants