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

Keep original SQL for CreateExternalTable #12653

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davisp
Copy link
Member

@davisp davisp commented Sep 27, 2024

Currently, the CreateExternalTable::definition field is just a stringfied version of the statement. Its slightly awkward to have the definition not be the same as what a user provided.

Which issue does this PR close?

Closes #12652

Rationale for this change

The CreateExternalTable::definition field isn't the same as what was provided to the SQL parser.

What changes are included in this PR?

This is a first draft at updating the CreateExternalTable::definition value to reflect what was provided.

Heads up, if folks are generally on board with the motivation here, I'm pretty sure we'll want to move the "render SQL between these two token indices" logic to live in the sqlparser crate. Here I've just implemented a less than optimal approach directly in DFParser to sketch out that the idea is vaguely possible. If folks are on board with this, I'd be more than happy to split that out and provide a proper implementation in the sqlparser crate that this change could then use.

Are these changes tested?

Yes-ish. I've updated the sql parser tests to match. Though there are tests in other parts of the project that are now failing after the change that I've not investigated. I'll obviously go chase down all those loose ends if/when there's consensus that this change is wanted at all.

Are there any user-facing changes?

Yes, though I expect a few requests for changes as I just wrote enough to show that it could work before polishing up into a complete PR.

  • datafusion_sql::parser::Statement::CreateExternalTable now has an Option<String> element.

I'm assuming the public enum change warrants the API change label, so I'll add that.

Currently, the CreateExternalTable::definition field is just a
stringfied version of the statement. Its slightly awkward to have the
definition not be the same as what a user provided.
@github-actions github-actions bot added sql SQL Planner core Core DataFusion crate labels Sep 27, 2024
Copy link

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale PR has not had any activity for some time label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sql SQL Planner Stale PR has not had any activity for some time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep the original SQL for CreateExternalTable::definition
1 participant