(&self, stmt: SetVariable)
| 1113 | } |
| 1114 | |
| 1115 | async fn set_variable(&self, stmt: SetVariable) -> Result<()> { |
| 1116 | let SetVariable { |
| 1117 | variable, value, .. |
| 1118 | } = stmt; |
| 1119 | |
| 1120 | // Check if this is a runtime configuration |
| 1121 | if variable.starts_with("datafusion.runtime.") { |
| 1122 | self.set_runtime_variable(&variable, &value)?; |
| 1123 | } else { |
| 1124 | let mut state = self.state.write(); |
| 1125 | state.config_mut().options_mut().set(&variable, &value)?; |
| 1126 | |
| 1127 | // Re-initialize any UDFs that depend on configuration |
| 1128 | // This allows both built-in and custom functions to respond to configuration changes |
| 1129 | let config_options = state.config().options(); |
| 1130 | |
| 1131 | // Collect updated UDFs in a separate vector |
| 1132 | let udfs_to_update: Vec<_> = state |
| 1133 | .scalar_functions() |
| 1134 | .values() |
| 1135 | .filter_map(|udf| { |
| 1136 | udf.inner() |
| 1137 | .with_updated_config(config_options) |
| 1138 | .map(Arc::new) |
| 1139 | }) |
| 1140 | .collect(); |
| 1141 | |
| 1142 | for udf in udfs_to_update { |
| 1143 | state.register_udf(udf)?; |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | Ok(()) |
| 1148 | } |
| 1149 | |
| 1150 | async fn reset_variable(&self, stmt: ResetVariable) -> Result<()> { |
| 1151 | let variable = stmt.variable; |
no test coverage detected