Skip to content

Make Logical Plans more readable by removing extra aliases - #10832

Merged
alamb merged 14 commits into
apache:mainfrom
MohamedAbdeen21:chained-aliases-in-plans
Jun 11, 2024
Merged

Make Logical Plans more readable by removing extra aliases#10832
alamb merged 14 commits into
apache:mainfrom
MohamedAbdeen21:chained-aliases-in-plans

Conversation

@MohamedAbdeen21

@MohamedAbdeen21MohamedAbdeen21 commented Jun 8, 2024

Copy link
Copy Markdown
Contributor

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-actionsgithub-actionsBot added logical-expr Logical plan and expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Jun 8, 2024
@MohamedAbdeen21
MohamedAbdeen21force-pushed the chained-aliases-in-plans branch from d497725 to c036309CompareJune 8, 2024 08:21
@MohamedAbdeen21MohamedAbdeen21 changed the title Chained aliases in plansMake Logical Plans more readable by removing extra aliasesJun 8, 2024
@MohamedAbdeen21
MohamedAbdeen21 marked this pull request as ready for review June 8, 2024 08:39
Comment threaddatafusion/optimizer/src/common_subexpr_eliminate.rs Outdated
Comment threaddatafusion/optimizer/src/common_subexpr_eliminate.rs Outdated
Comment threaddatafusion/optimizer/src/common_subexpr_eliminate.rs Outdated
Comment threaddatafusion/optimizer/src/common_subexpr_eliminate.rs
Comment threaddatafusion/expr/src/expr.rs Outdated

@peter-tothpeter-toth left a comment

Copy link
Copy Markdown
Contributor

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

Comment threaddatafusion/sqllogictest/test_files/tpch/q1.slt.part Outdated
@github-actionsgithub-actionsBot removed the logical-expr Logical plan and expressions label Jun 9, 2024
@MohamedAbdeen21MohamedAbdeen21 mentioned this pull request Jun 11, 2024

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

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:mainJun 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizerOptimizer rulessqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@MohamedAbdeen21@alamb@peter-toth