houqp commented on a change in pull request #1071:
URL: https://github.com/apache/arrow-datafusion/pull/1071#discussion_r721890874
##########
File path: datafusion/src/physical_plan/functions.rs
##########
@@ -1088,11 +1172,12 @@ fn signature(fun: &BuiltinScalarFunction) -> Signature {
// for now, the list is small, as we do not have many built-in functions.
match fun {
- BuiltinScalarFunction::Array => {
-
Signature::Variadic(array_expressions::SUPPORTED_ARRAY_TYPES.to_vec())
- }
+ BuiltinScalarFunction::Array => Signature::variadic(
+ array_expressions::SUPPORTED_ARRAY_TYPES.to_vec(),
+ Volatility::Immutable,
Review comment:
better use `fun::volatility()` to get the volatility here so we can
manage the volatility in a single place.
##########
File path: datafusion/src/physical_plan/functions.rs
##########
@@ -234,6 +310,14 @@ impl BuiltinScalarFunction {
BuiltinScalarFunction::Random | BuiltinScalarFunction::Now
)
}
+ /// Returns the [Volatility] of the builtin function.
+ pub fn volatility(&self) -> Volatility {
+ match self {
+ BuiltinScalarFunction::Random => Volatility::Volatile,
+ BuiltinScalarFunction::Now => Volatility::Stable,
+ _ => Volatility::Immutable,
Review comment:
perhaps it would be better to explicitly match each individual enum
variant here so we don't accidentally set newly added variant to immutable?
--
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]