alamb opened a new issue #1469:
URL: https://github.com/apache/arrow-datafusion/issues/1469


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   While working on some other code, I noticed that 
`SqlToRel::statement_to_plan` takes a reference to the parse tree -- this 
results in having to `clone()` many values (identifiers, etc) while converting 
a parsed SQL query to a `LogicalPlan`
   
   The only 
[callsite](https://github.com/apache/arrow-datafusion/blob/9d3186693b614db57143adbd81c82a60752a8bac/datafusion/src/execution/context.rs#L295)
 I could find throws away the parsed query immediately; Doing this would likely 
save lots of cloning internal to SqlToRel
   
   **Describe the solution you'd like**
   
   If someone wanted a fun project, they could convert 
`SqlToRel::statement_to_pan` to take ownership rather than references.
   
https://github.com/apache/arrow-datafusion/blob/0052667afae33ba9e549256d0d5d47e2f45e6ffb/datafusion/src/sql/planner.rs#L121
   
   Specifically, change:
   ```
       pub fn statement_to_plan(&self, statement: &DFStatement) -> 
Result<LogicalPlan> {
   ```
   
   To
   ```rust
       pub fn statement_to_plan(&self, statement: DFStatement) -> 
Result<LogicalPlan> {
   ```
   
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   This would be a software engineering exercise -- it wouldn't really require 
much in the way of knowledge of the guts of DataFusion


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to