Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse alias if possible #14781

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

blaginin
Copy link
Contributor

Which issue does this PR close?

Follow up on #14684 (comment)

Rationale for this change

Currently, alias over alias creates an extra expression layer, which gets merged in optimize_projections through an expensive recursive function

What changes are included in this PR?

A small change to reuse an existing alias when possible. This affects two cases:

  • Removes unnecessary info when displaying logical plans
  • Simplifies expressions when optimize_projections isn't called (e.g., when there's only one projection and merge_consecutive_projections isn't run)

Are these changes tested?

Extended doctest

Are there any user-facing changes?

No.

@github-actions github-actions bot added logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt) labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant