crepererum commented on code in PR #8520:
URL: https://github.com/apache/arrow-datafusion/pull/8520#discussion_r1425217377
##########
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:
Under which condition does the optimizer see an unresolved function name?
And: if we don't know how the function behaves (because there's only a name)
shouldn't we assume the worst case (i.e. that it is volatile)?
--
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]