apache / datafusion

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

Change *ExecutionPlan* from trait to enum similar as *LogicalPlan* #3651

Open yahoNanJing opened 1 year ago

yahoNanJing commented 1 year ago

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

As #2175 mentioned, if we still keep ExecutionPlan as a trait, its related trait object usage will cause many limitations, like not feasible to return Self, inconvenience pattern matching, etc.

Describe the solution you'd like

It's better to change the ExecutionPlan from trait to enum similar as LogicalPlan. For the extension of execution plan, we can introduce a trait for that to provide some extent flexibility, like

enum ExecutionPlan {
  ...
  Extension {
    extension: Arc<dyn ExecutionPlanExtension>,
  }
  ... 
}

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context

2175

alamb commented 1 year ago

We might want to send a note to the email list and slack channel to let people know of this change. It is likely to cause significant code churn in all downstream projects.

alamb commented 1 year ago

See also @tustvold 's comments on https://github.com/apache/arrow-datafusion/issues/2175#issuecomment-1262554350

andygrove commented 1 year ago

Rather than changing ExectionPlan to be an enum, why don't we add a new enum that can wrap ExecutionPlan? See https://github.com/apache/arrow-datafusion/pull/3677 for my proposal.