Skip to content

fix!: normalize join operands to aliased FROM clause nodes - #1100

Merged
domoritz merged 1 commit into
mainfrom
normalize-join-operands
Jul 31, 2026
Merged

fix!: normalize join operands to aliased FROM clause nodes#1100
domoritz merged 1 commit into
mainfrom
normalize-join-operands

Conversation

@domoritz

@domoritz domoritz commented Jul 27, 2026

Copy link
Copy Markdown
Member

Changes the JoinNode to require FromNode which lets us simplify filter pushdown. Not sure what the original use case in #888 was but this simplification/tightening avoids downstream errors as we saw in filter pushdown (#1074). Subquery join operands are now parenthesized, and schema-qualified refs drop a redundant alias that broke full-path qualifiers.

Filed #1101 as a follow up related to push down a review with Claude found.

@domoritz
domoritz force-pushed the normalize-join-operands branch 2 times, most recently from 73d72dd to 8470011 Compare July 27, 2026 04:56
@domoritz
domoritz marked this pull request as ready for review July 27, 2026 05:02
@domoritz
domoritz requested a review from jheer as a code owner July 27, 2026 05:02
@domoritz
domoritz force-pushed the normalize-join-operands branch 3 times, most recently from a830078 to a5672e0 Compare July 27, 2026 05:18
@domoritz domoritz changed the title refactor!: Normalize join operands, simplify filter pushdown fix: Normalize join operands to aliased FROM clause nodes Jul 27, 2026
@domoritz
domoritz force-pushed the normalize-join-operands branch from a5672e0 to a6bc1e6 Compare July 27, 2026 05:21
@domoritz domoritz changed the title fix: Normalize join operands to aliased FROM clause nodes fix!: normalize join operands to aliased FROM clause nodes Jul 27, 2026
@domoritz
domoritz force-pushed the normalize-join-operands branch from a6bc1e6 to 8e8509a Compare July 27, 2026 05:22
Add an asFrom coercion that wraps table names and references in a FROM
clause aliased by the table name, like Query.from, and use it for join
operands. Filter pushdown no longer needs to wrap join operands itself,
since every source that can carry an alias now does.

Codegen now omits aliases that match the visible table name, so the
added aliases do not appear in generated SQL: they serialize only once
a transform such as filter pushdown renames the underlying reference.
This also drops the redundant alias Query.from previously serialized
for schema-qualified table references. Subquery join operands gain the
parentheses they previously lacked.

BREAKING CHANGE: JoinNode.left and JoinNode.right are typed FromNode
instead of FromNode | TableRefNode, and the join builders wrap table
name operands in FromClauseNode. Code that inspects join operands as
bare TableRefNodes must unwrap the FromClauseNode expr instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@domoritz
domoritz force-pushed the normalize-join-operands branch from 8e8509a to 8ac9d17 Compare July 27, 2026 15:57
@domoritz domoritz changed the title fix!: normalize join operands to aliased FROM clause nodes refactor!: normalize join operands to aliased FROM clause nodes Jul 27, 2026
@domoritz domoritz changed the title refactor!: normalize join operands to aliased FROM clause nodes fix!: normalize join operands to aliased FROM clause nodes Jul 27, 2026
@domoritz
domoritz merged commit a803999 into main Jul 31, 2026
5 checks passed
@domoritz
domoritz deleted the normalize-join-operands branch July 31, 2026 03:52
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.

2 participants