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

Add an example of how to convert LogicalPlan to/from SQL Strings #10550

Closed
Tracked by #9494
alamb opened this issue May 16, 2024 · 0 comments · Fixed by #10558
Closed
Tracked by #9494

Add an example of how to convert LogicalPlan to/from SQL Strings #10550

alamb opened this issue May 16, 2024 · 0 comments · Fixed by #10558
Labels
enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented May 16, 2024

Part of #9494

Is your feature request related to a problem or challenge?

Having a good example helps to make features easier to use in DataFusion

In this case the usecase is programmatic construction of SQL using the DataFUsion LogicalPlan s using the api from #9726

Describe the solution you'd like

Extend the example from @edmondop 's great work in #10528 with the following cases:

  1. Create a plan using the DataFrame API and converting it back to SQL

Bonus points for also adding
3. Parse SQL like SELECT * from foo into a DataFrame, adding a filter, and then converting that back to SQL

Describe alternatives you've considered

Here is an example of creating a dataframe example https://docs.rs/datafusion/latest/datafusion/index.html#dataframe

You can call DataFrame::logical_plan to get the plan

Then call plan_to_sql and demonstrate the SQL that was created

https://github.com/apache/datafusion/blob/842f3933e3496a022984c2a37254475a3bcde1bf/datafusion/sql/tests/sql_integration.rs#L4689C1-L4690C51

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant