Skip to content

Conversation

@MohamedAbdeen21
Copy link
Contributor

@MohamedAbdeen21 MohamedAbdeen21 commented Jun 8, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

Removing unnecessary aliasing in the logical plan (Check changed tests)

What changes are included in this PR?

Some rules need expressions to be aliased and Common Subexpr Elimination (CSE) rule used to create these aliases. CSE rule now checks if the expr already has an alias before assigning a new one. cc @peter-toth

Are these changes tested?

Yes

Are there any user-facing changes?

Slightly more readable logical plans.

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Jun 8, 2024
@MohamedAbdeen21 MohamedAbdeen21 force-pushed the chained-aliases-in-plans branch from d497725 to c036309 Compare June 8, 2024 08:21
@MohamedAbdeen21 MohamedAbdeen21 changed the title Chained aliases in plans Make Logical Plans more readable by removing extra aliases Jun 8, 2024
@MohamedAbdeen21 MohamedAbdeen21 marked this pull request as ready for review June 8, 2024 08:39
Copy link
Contributor

@peter-toth peter-toth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I only have minor suggestions.

cc @alamb

@github-actions github-actions bot removed the logical-expr Logical plan and expressions label Jun 9, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great -- thank you @MohamedAbdeen21 and @peter-toth

@alamb alamb merged commit 0ec292f into apache:main Jun 11, 2024
@MohamedAbdeen21 MohamedAbdeen21 deleted the chained-aliases-in-plans branch June 30, 2024 20:42
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
)

* logical plan: remove unnecessary aliases

* revert EnterMark

* fix docs and benchmarks

* revert id_array change

* add alias counter

* fix alias counter bug

* fix slt test

* fix benchmark results

* revert alias/unalias changes

* remove TODO

* minor fix

* fix benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants