(&self, variable: &str, value: &str)
| 1176 | } |
| 1177 | |
| 1178 | fn set_runtime_variable(&self, variable: &str, value: &str) -> Result<()> { |
| 1179 | let key = variable.strip_prefix("datafusion.runtime.").unwrap(); |
| 1180 | |
| 1181 | let mut state = self.state.write(); |
| 1182 | |
| 1183 | let mut builder = RuntimeEnvBuilder::from_runtime_env(state.runtime_env()); |
| 1184 | builder = match key { |
| 1185 | "memory_limit" => { |
| 1186 | let memory_limit = Self::parse_capacity_limit(variable, value)?; |
| 1187 | builder.with_memory_limit(memory_limit, 1.0) |
| 1188 | } |
| 1189 | "max_temp_directory_size" => { |
| 1190 | let directory_size = Self::parse_capacity_limit(variable, value)?; |
| 1191 | builder.with_max_temp_directory_size(directory_size as u64) |
| 1192 | } |
| 1193 | "temp_directory" => builder.with_temp_file_path(value), |
| 1194 | "metadata_cache_limit" => { |
| 1195 | let limit = Self::parse_capacity_limit(variable, value)?; |
| 1196 | builder.with_metadata_cache_limit(limit) |
| 1197 | } |
| 1198 | "list_files_cache_limit" => { |
| 1199 | let limit = Self::parse_capacity_limit(variable, value)?; |
| 1200 | builder.with_object_list_cache_limit(limit) |
| 1201 | } |
| 1202 | "list_files_cache_ttl" => { |
| 1203 | let duration = Self::parse_duration(variable, value)?; |
| 1204 | builder.with_object_list_cache_ttl(Some(duration)) |
| 1205 | } |
| 1206 | "file_statistics_cache_limit" => { |
| 1207 | let limit = Self::parse_capacity_limit(variable, value)?; |
| 1208 | builder.with_file_statistics_cache_limit(limit) |
| 1209 | } |
| 1210 | _ => return plan_err!("Unknown runtime configuration: {variable}"), |
| 1211 | // Remember to update `reset_runtime_variable()` when adding new options |
| 1212 | }; |
| 1213 | |
| 1214 | *state = SessionStateBuilder::from(state.clone()) |
| 1215 | .with_runtime_env(Arc::new(builder.build()?)) |
| 1216 | .build(); |
| 1217 | |
| 1218 | Ok(()) |
| 1219 | } |
| 1220 | |
| 1221 | fn reset_runtime_variable(&self, variable: &str) -> Result<()> { |
| 1222 | let key = variable.strip_prefix("datafusion.runtime.").unwrap(); |
no test coverage detected