Skip to content

Track prunability of inner joins on the expression itself #32674

Merged
roji merged 1 commit intodotnet:mainfrom
roji:PruningRemovableJoins
Dec 30, 2023
Merged

Track prunability of inner joins on the expression itself #32674
roji merged 1 commit intodotnet:mainfrom
roji:PruningRemovableJoins

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Dec 25, 2023

When a join is added to a select, it's optionally marked as removable, i.e. eligible for pruning if not referenced by any column; this is checked while pruning to prevent removing joins which are important for preserving correct data even when not referenced (e.g. an inner join can be used to filter).

In line with the current architecture, this information is stored on a private list on SelectExpression; this means that all code that accesses it must be on SelectExpression itself (and not on an external visitor, where it can be overridden e.g. by a provider); it also means we must take care to always copy it when duplicating selects, and generally causes unnecessary bookkeeping.

This PR is a pure refactor which moves the information to the tables themselves, where it can be accessed freely from anywhere. This is part of a larger effort to remove private state from SelectExpression and simplify the pipeline.

Part of #31049

Instead of on a private list on SelectExpression.
Part of dotnet#31049
@roji roji force-pushed the PruningRemovableJoins branch from 1f09220 to ff71406 Compare December 29, 2023 15:30
@roji roji merged commit e093b2c into dotnet:main Dec 30, 2023
@roji roji deleted the PruningRemovableJoins branch December 30, 2023 07:30
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