crepererum commented on code in PR #8520:
URL: https://github.com/apache/arrow-datafusion/pull/8520#discussion_r1425370439
##########
datafusion/expr/src/expr.rs:
##########
@@ -373,6 +373,20 @@ impl ScalarFunctionDefinition {
ScalarFunctionDefinition::Name(func_name) => func_name.as_ref(),
}
}
+
+ /// Whether this function is volatile, i.e. whether it can return
different results
+ /// when evaluated multiple times with the same input.
+ pub fn is_volatile(&self) -> bool {
+ match self {
+ ScalarFunctionDefinition::BuiltIn(fun) => {
+ fun.volatility() == crate::Volatility::Volatile
+ }
+ ScalarFunctionDefinition::UDF(udf) => {
+ udf.signature().volatility == crate::Volatility::Volatile
+ }
+ ScalarFunctionDefinition::Name(_) => false,
Review Comment:
The "resolve" pass should probably run before other optimizers then, right?
So maybe it's even safe to error out if we hit an unresolved function here.
--
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]