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

Improve SQLite subquery tables aliasing unparsing #12482

Merged

Conversation

sgrebnov
Copy link
Member

Which issue does this PR close?

Follow up PR for #12331 that improves SQLite subquery tables aliasing unparsing to support more complex cases, for example

SELECT * FROM (SELECT o_orderkey + 1 FROM orders) AS c(key) LIMIT 10

SELECT * FROM (SELECT o_orderkey FROM orders LIMIT 10) AS c(key) LIMIT 10

What changes are included in this PR?

PRs modifies LogicalPlan::SubqueryAlias(plan_alias) unparser to support more complex table aliasing scenarios for SQLite:
1 - calculated columns
2- cases where subquery projection is wrapped by other operators (e.g., LIMIT, SORT)

Are these changes tested?

Tested manually and added unit tests

Are there any user-facing changes?

No

@github-actions github-actions bot added the sql SQL Planner label Sep 16, 2024
@sgrebnov sgrebnov force-pushed the sgrebnov/improve-sqlite-subquery-unparsing branch from 60f3169 to 1146677 Compare September 16, 2024 06:15
@alamb
Copy link
Contributor

alamb commented Sep 16, 2024

cc @phillipleblanc

Copy link
Contributor

@phillipleblanc phillipleblanc left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@demetribu demetribu left a comment

Choose a reason for hiding this comment

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

lgtm
Thank you @sgrebnov

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.

Thank you @sgrebnov and @phillipleblanc and @dmitrybugakov for the review -- I took a cursor look at this PR and it looks great!

@alamb alamb merged commit 8555e41 into apache:main Sep 17, 2024
24 checks passed
@phillipleblanc phillipleblanc deleted the sgrebnov/improve-sqlite-subquery-unparsing branch September 17, 2024 23:38
phillipleblanc pushed a commit to spiceai/datafusion that referenced this pull request Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants