Skip to content

Commit d218c2e

Browse files
committed
PlanningPerf: Add global default ConfigOptions
1 parent 3bdcdf5 commit d218c2e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

datafusion/common/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use std::fmt::{self, Display};
3636
use std::str::FromStr;
3737
#[cfg(feature = "parquet_encryption")]
3838
use std::sync::Arc;
39+
use std::sync::LazyLock;
3940

4041
/// A macro that wraps a configuration struct and automatically derives
4142
/// [`Default`] and [`ConfigField`] for it, allowing it to be used
@@ -1382,12 +1383,21 @@ impl ConfigField for ConfigOptions {
13821383
/// (FFI) based configuration extensions.
13831384
pub const DATAFUSION_FFI_CONFIG_NAMESPACE: &str = "datafusion_ffi";
13841385

1386+
/// Global default configuration options
1387+
static DEFAULT_CONFIG: LazyLock<Arc<ConfigOptions>> =
1388+
LazyLock::new(|| Arc::new(ConfigOptions::new()));
1389+
13851390
impl ConfigOptions {
13861391
/// Creates a new [`ConfigOptions`] with default values
13871392
pub fn new() -> Self {
13881393
Self::default()
13891394
}
13901395

1396+
/// Return a reference to the default configuration options
1397+
pub fn default_arc() -> Arc<Self> {
1398+
Arc::clone(&DEFAULT_CONFIG)
1399+
}
1400+
13911401
/// Set extensions to provided value
13921402
pub fn with_extensions(mut self, extensions: Extensions) -> Self {
13931403
self.extensions = extensions;

datafusion/expr/src/simplify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl Default for SimplifyContext {
4545
Self {
4646
schema: Arc::new(DFSchema::empty()),
4747
query_execution_start_time: None,
48-
config_options: Arc::new(ConfigOptions::default()),
48+
config_options: ConfigOptions::default_arc(),
4949
}
5050
}
5151
}

0 commit comments

Comments
 (0)