alamb commented on code in PR #8520:
URL: https://github.com/apache/arrow-datafusion/pull/8520#discussion_r1425283963
##########
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:
I agree we should assume it is volatile given lack of additional
information
At this moment, I don't think the optimizer will ever see unresolved
function names
The plan is to use them to implement `expr_fn`s like
[`power`](https://docs.rs/datafusion/latest/datafusion/logical_expr/fn.power.html)
once we remove the hard coded list of built in functions as decsribed in
https://github.com/apache/arrow-datafusion/issues/8045
In fact @edmondop is working on this as part of
https://github.com/apache/arrow-datafusion/issues/8157
--
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]