jayzhan211 commented on issue #6747:
URL: https://github.com/apache/datafusion/issues/6747#issuecomment-2236290278

   The overall idea looks good to me, but I'm not sure about the `Case` you 
mentioned, is there any Expr that is also possible be benefited from builder 
mode?
   
   My current idea is specific to function only, but if there is other 
non-function expr, we could extend it like ExprExt, ExprBuidler with the 
related methods they need.
   
   ```rust
   pub trait FunctionExt {
       /// Add `ORDER BY <order_by>`
       ///
       /// Note: `order_by` must be [`Expr::Sort`]
       fn order_by(self, order_by: Vec<Expr>) -> AggregateBuilder;
       /// Add `FILTER <filter>`
       fn filter(self, filter: Expr) -> AggregateBuilder;
       /// Add `DISTINCT`
       fn distinct(self) -> AggregateBuilder;
       /// Add `RESPECT NULLS` or `IGNORE NULLS`
       fn null_treatment(self, null_treatment: NullTreatment) -> 
AggregateBuilder;
   
       fn partiion_by:
       fn window_frame:
       ...
   }
   
   pub struct FuncBuilder {
       fun: Option<FuncKind>,
       order_by: Option<Vec<Expr>>,
       filter: Option<Expr>,
       distinct: bool,
       null_treatment: Option<NullTreatment>,
       partition_by,
       window_frame,
       ....
   }
   
   pub enum FuncKind {
       Aggregate(AggregateFunction),
       Window(WindowFunction),
   }
   ```
   


-- 
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...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to