Skip to content

Allow flag to alias all projected substrait expressions with a UUID - #19123

Closed
xanderbailey wants to merge 7 commits into
apache:mainfrom
xanderbailey:xb/allow_uuid_alias_for_all_substrait_expressions
Closed

Allow flag to alias all projected substrait expressions with a UUID#19123
xanderbailey wants to merge 7 commits into
apache:mainfrom
xanderbailey:xb/allow_uuid_alias_for_all_substrait_expressions

Conversation

@xanderbailey

@xanderbaileyxanderbailey commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

As previously discussed in #17299. This continues to be a bit of a thorn for expressions that are the same on the left and the right side of the of a join leading to ambiguous references.

Downside here is that it makes the plan less readable which is why I thought it would be better if this was a config that users can opt into to make things more stable. Having said that in my experience the plans created via substrait are super hard to read anyway. If you have a deeply nested CAST statement for example then the name that appears in the plan is unintelligible anyway.

What changes are included in this PR?

Adds substrait_alias_all_expressions config which applies a UUID alias to all expressions during substrait conversion.

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actionsgithub-actionsBot added substrait Changes to the substrait crate common Related to common crate labels Dec 5, 2025
}

#[tokio::test]
async fn alias_all_expressions_flag() -> Result<()> {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Happy to take ideas on the best way to write this test but I wanted to show that the UUIDs actually light up correctly.

@xanderbaileyxanderbailey changed the title Allow flag to alias all prjected substrait expressions with a UUIDAllow flag to alias all projected substrait expressions with a UUIDDec 5, 2025
@xanderbailey
xanderbaileyforce-pushed the xb/allow_uuid_alias_for_all_substrait_expressions branch from 5541990 to 1f51265CompareDecember 5, 2025 21:05
@github-actionsgithub-actionsBot added the sqllogictest SQL Logic Tests (.slt) label Dec 10, 2025
@github-actionsgithub-actionsBot added the documentation Improvements or additions to documentation label Dec 10, 2025
@xanderbailey

Copy link
Copy Markdown
ContributorAuthor

@LiaCastaneda thought you might have some ideas here

@LiaCastaneda

Copy link
Copy Markdown
Contributor

👋 Sorry for the late reply,
I think this fixes all the issues once for all, however I'm wondering if maybe it would be worth it to make this fix in the name tracker instead? as suggested in #17508. From my understanding what would have to be done is basically track two fields which are the schema name and the qualified name.
cc @dd-annarose since you were looking into this.

@xanderbailey

Copy link
Copy Markdown
ContributorAuthor

I'm happy if there's a better route forward we're just looking for a quick fix without having to fork the whole substrait conversation.

@xanderbailey

Copy link
Copy Markdown
ContributorAuthor

Had a go at the fix here #19856

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commonRelated to common cratedocumentationImprovements or additions to documentationsqllogictestSQL Logic Tests (.slt)substraitChanges to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expressions from left and right of a join can fail planning during substrait converstion if their name is the same

2 participants

@xanderbailey@LiaCastaneda