jonathanc-n commented on code in PR #17351: URL: https://github.com/apache/datafusion/pull/17351#discussion_r2317357983
########## 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 { Review Comment: Should we not give a default and have every expression implement this. I could see this being missed + difficult for reviewers to look at for this when new physical expressions are added. Could do as follow up. -- 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