milenkovicm opened a new issue, #7660:
URL: https://github.com/apache/arrow-datafusion/issues/7660

   ### Is your feature request related to a problem or challenge?
   
   Most operations on `DataFrame` will modify current `LogicalPlan` crating new 
`DataFrame` as the result.
   At the moment I see no option to modify `df.plan` adding 
`LogicalPlan::Extension` node to it.
   
   ### Describe the solution you'd like
   
   The approach which IMHO makes sense would be to add additional trait 
`DataFrameExtend` which would expose a single function, roughly something 
similar to:
   
   ```rust
   pub trait DataFrameExtend {
     fn map_plan(MF: FnOnce(LogicalPlan) -> Result<LogicalPlan> > (self, map: 
MF) -> Result<DataFrame>
   }
   
   impl DataFrameExtend for DataFrame {
     fn map_plan(F: FnOnce(LogicalPlan) -> Result<LogicalPlan> > (self, map: F) 
-> Result<DataFrame> {
       let session_state = self.session_state;
       let new_plan = map(self.plan);
       Ok(DataFrame::new(session_state, plan))
     }
   }
   ```
   
   This way `DataFrame` API would not change, unless `DataFrameExtend` is 
included. 
   
   
   
   
   ### Describe alternatives you've considered
   
   Alternatives: 
   - expose `df.session_state` either making it public or adding a accessor 
method, let the users create new DataFrame themselfs
   - put `map_plan` to `DataFrame`, which will impact public api and expose 
method which is not needed in too many cases
   
   ### Additional context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to