milenkovicm commented on PR #10354: URL: https://github.com/apache/datafusion/pull/10354#issuecomment-2092903670
jsut thinking aloud, maybe if we change: ```rust pub enum ExprSimplifyResult { /// The function call was simplified to an entirely new Expr Simplified(Expr), /// the function call could not be simplified, and the arguments /// are return unmodified. Original(Vec<Expr>), } ``` to: ```rust pub enum ExprSimplifyResult<T> { /// The function call was simplified to an entirely new Expr Simplified(Expr), /// the function call could not be simplified, and the arguments /// are return unmodified. Original(T), } ``` simplify method would change from: ```rust pub fn simplify( &self, args: Vec<Expr>, distinct: &bool, filter: &Option<Box<Expr>>, order_by: &Option<Vec<Expr>>, null_treatment: &Option<NullTreatment>, info: &dyn SimplifyInfo, ) -> Result<ExprSimplifyResult> { ``` to: ```rust pub fn simplify( &self, args: Vec<Expr>, distinct: bool, filter: Option<Box<Expr>>, order_by: Option<Vec<Expr>>, null_treatment: Option<NullTreatment>, info: &dyn SimplifyInfo, ) -> Result<ExprSimplifyResult<(Vec<Expr>, bool, Option<Box<Expr>> ...)>> { } ``` so in both cases, when we create replacement function or we re-assemble original function we would not need to clone parameters. Not too many changes in the code, few`-> Result<ExprSimplifyResult>` to `-> Result<ExprSimplifyResult<Vec<Expr>>>` changes Downside is that we would have to re-create expression if no simplification -- 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