adriangb commented on code in PR #17351: URL: https://github.com/apache/datafusion/pull/17351#discussion_r2324657452
########## datafusion/physical-expr-common/src/physical_expr.rs: ########## @@ -377,6 +377,19 @@ pub trait PhysicalExpr: Any + Send + Sync + Display + Debug + DynEq + DynHash { // static expressions will always return 0. 0 } + + /// Returns true if the expression node is volatile, i.e. whether it can return + /// different results when evaluated multiple times with the same input. + /// + /// Note: unlike [`is_volatile`], this function does not consider inputs: + /// - `random()` returns `true`, + /// - `a + random()` returns `false` + /// + /// By default, expressions are not volatile to avoid imposing API churn on implementers. + /// It is highly recommended that volatile expressions implement this method and return `true`. + fn is_volatile_node(&self) -> bool { + false Review Comment: I agree this is not a safe default long term. I can add a comment about it. Do you think it's better to just eat the cost of the breaking change now? My thought was that we've lived with a world where if you have a custom volatile expression you can't teach DataFusion about it for a long time now. This just means that you can fix it in your code instead of ours. But having no default means breaking changes for a lot of people. -- 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