alamb commented on code in PR #18017:
URL: https://github.com/apache/datafusion/pull/18017#discussion_r2432548305
##########
datafusion/functions/src/datetime/now.rs:
##########
@@ -54,6 +57,15 @@ impl NowFunc {
Self {
signature: Signature::nullary(Volatility::Stable),
aliases: vec!["current_timestamp".to_string()],
+ timezone: Some(Arc::from("+00")),
Review Comment:
Can someone explain the implications of this change on downstream crates?
Does it mean that that `now()` will always uses the current timezone from the
ConfigOptions?
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1072,6 +1072,28 @@ impl SessionContext {
} else {
let mut state = self.state.write();
state.config_mut().options_mut().set(&variable, &value)?;
+
+ // Re-initialize any UDFs that depend on configuration
+ // This allows both built-in and custom functions to respond to
configuration changes
+ let config_options = state.config().options();
+ let udf_names: Vec<_> =
state.scalar_functions().keys().cloned().collect();
Review Comment:
why do we need to "clone()" the keys (all the function names)? It seems like
only the &name is used below
##########
datafusion/expr/src/udf.rs:
##########
@@ -532,6 +532,25 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send +
Sync {
/// [`DataFusionError::Internal`]:
datafusion_common::DataFusionError::Internal
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType>;
+ /// Create a new instance of this function with updated configuration.
+ ///
+ /// This method is called when configuration options change at runtime
+ /// (e.g., via `SET` statements) to allow functions that depend on
+ /// configuration to update themselves accordingly.
+ ///
+ /// # Arguments
+ ///
+ /// * `config` - The updated configuration options
+ ///
+ /// # Returns
+ ///
+ /// * `Some(ScalarUDF)` - A new instance of this function configured with
the new settings
+ /// * `None` - If this function does not support runtime reconfiguration
Review Comment:
```suggestion
/// * `None` - If this function does not change with new configuration
settings (the default)
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]