apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
6.33k stars 1.2k forks source link

Keep the original SQL for CreateExternalTable::definition #12652

Open davisp opened 1 month ago

davisp commented 1 month ago

Is your feature request related to a problem or challenge?

Currently, the CreateExternalTable definition is just a stringified version of the statement, rather than the original SQL that was parsed.

Describe the solution you'd like

I'd like to propose capturing the original SQL as provided and storing that instead so that when a definition is displayed, it matches what a user originally provided.

Describe alternatives you've considered

Nothing comes to mind. Its a fairly small change.

Additional context

No response

davisp commented 1 month ago

I've opened a draft PR to show that there's a what appears to be a reasonable approach to handling this if anyone is interested in checking that out. I'm fully aware that its a bit hacky and a proper PR will likely involve splitting some of the logic into the sqlparser crate which I'm more than happy to do as a precondition. I just didn't want to invest that much time in pursuing this until there's some general agreement that this is even a desirable change.