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

Fix plan_to_sql: Add wildcard projection to SELECT statement if no projection was set #11744

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

LatrecheYasser
Copy link
Contributor

Which issue does this PR close?

Closes #11743.

Rationale for this change

This PR will check the select_builder in the select_to_sql_expr after calling the select_to_sql_recursively and if no projection is set, it will add a projection with one element set to ast::SelectItem::Wildcard(ast::WildcardAdditionalOptions::default())

What changes are included in this PR?

The changes described above, and some test cases.

Are these changes tested?

Yes.

Are there any user-facing changes?

I would say no.

@github-actions github-actions bot added the sql SQL Planner label Jul 31, 2024
@LatrecheYasser LatrecheYasser changed the title feat: Add wildcard projection to SELECT statement if no projection was set fix: Add wildcard projection to SELECT statement if no projection was set Jul 31, 2024
@LatrecheYasser LatrecheYasser changed the title fix: Add wildcard projection to SELECT statement if no projection was set Fix: Add wildcard projection to SELECT statement if no projection was set Jul 31, 2024
@alamb alamb changed the title Fix: Add wildcard projection to SELECT statement if no projection was set Fix plan_to_sql: Add wildcard projection to SELECT statement if no projection was set Jul 31, 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.

Thank you @LatrecheYasser -- this looks good to me. I started the CI checks and assuming they pass I think this PR is ready to go

@alamb
Copy link
Contributor

alamb commented Jul 31, 2024

https://github.com/apache/datafusion/actions/runs/10179108058/job/28167144185?pr=11744 is failing -- I think we can fix that by running cargo fmt and committing the result

@LatrecheYasser
Copy link
Contributor Author

https://github.com/apache/datafusion/actions/runs/10179108058/job/28167144185?pr=11744 is failing -- I think we can fix that by running cargo fmt and committing the result

thanks @alamb I will run the cargo fmt and push a new commit. Thanks for the quick review

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 good to me -- thank you @LatrecheYasser

@alamb alamb merged commit 1ce5461 into apache:main Aug 1, 2024
24 checks passed
@alamb
Copy link
Contributor

alamb commented Aug 1, 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.

TableScan plan without projection is not converted correctly to a sql statement
2 participants