-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Consolidate DDL / Catalog manipulation LogicalPlans (refactor) #3349
Comments
Another option here would be to remove such DDL from The interface for I'll have a play and see what I can come up with |
FWIW, doing so would undo the motivation behind the PR that kicked off this discussion. I think if we have: LogicalPlan::DDL Then the planner can still do things like optimize DML, replace placeholder tokens in DML/DQL, etc. It also makes it so there is a consistent path in execution engines: AST -> LogicalPlan -> PhysicalPlan vs AST -> [LogicalPlan, Statement] -> [query plan executor, statement executor] however, if we merely group them as mentioned in this issue, then we can have the existing optimizer code focus on LogicalPlan::DQL and the rest of the code can keep functioning as it is. Just my $0.02, interested to hear how this affects others... |
I believe all such plans are now part of LogicalPlan::Dml / LogicalPlan::Ddl so closing this issue https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.LogicalPlan.html#variant.Dml and https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.LogicalPlan.html#variant.Ddl |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I would like to more cleanly separate the DDL (data definition) statements supported by DataFusion from the query execution.
Specifically, DataFusion offers basic support for "catalog" like operations such as registering external tables (
CREATE EXTERNAL TABLE
) , views (CREATE VIEW
) and others. Some systems (likedatafusion-cli
or thetpch-benchmarks
) use this basic support and others such as https://github.com/influxdata/influxdb_iox use DataFusion to query tables and views that are defined elsewhere.The current support for catalog like operations is implemented as individual
LogicalPlan
variants such asLogicalPlan::CreateExternalTable
https://github.com/apache/arrow-datafusion/blob/5621e3bbd050eeb79646240ec0a09426badfa162/datafusion/expr/src/logical_plan/plan.rs#L77-L90
This results in two potential issues:
DROP TABLE
, as in implementdrop view
#3267) results in a bunch of boiler plate that may not be neededCREATE VIEW
orCREATE TABLE
if that is not desired ( because, e.g. it would be a security hole - see this test):Describe the solution you'd like
I would like to consolidate
LogicalPlan::Create*
andLogicalPlan::Drop*
variants into a singleLogicalPlan::DDL
variant, and make a newDDLStatement
enum likeDescribe alternatives you've considered
We can not make any changes (as this change would result in some API churn)
Additional context
See #3267 (comment)
The text was updated successfully, but these errors were encountered: