viirya commented on code in PR #8520:
URL: https://github.com/apache/arrow-datafusion/pull/8520#discussion_r1425883164
##########
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:
It makes sense to get error on unresolved scalar function here. Missing that
it is a unresolved one. (maybe renaming it to `Unresolved` 🤔 ).
##########
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:
It makes sense to get error on unresolved scalar function here. Missing that
it is a unresolved one. (maybe renaming it to `Unresolved` 🤔 ).
--
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]