-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ShowVariable Statement #3455
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -841,6 +841,7 @@ impl SessionContext { | |
let catalog = if information_schema { | ||
Arc::new(CatalogWithInformationSchema::new( | ||
Arc::downgrade(&state.catalog_list), | ||
Arc::downgrade(&state.config.config_options), | ||
catalog, | ||
)) | ||
} else { | ||
|
@@ -1130,7 +1131,7 @@ pub struct SessionConfig { | |
/// Should DataFusion parquet reader using the predicate to prune data | ||
pub parquet_pruning: bool, | ||
/// Configuration options | ||
pub config_options: ConfigOptions, | ||
pub config_options: Arc<RwLock<ConfigOptions>>, | ||
Comment on lines
1133
to
+1134
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change
|
||
/// Opaque extensions. | ||
extensions: AnyMap, | ||
} | ||
|
@@ -1147,7 +1148,7 @@ impl Default for SessionConfig { | |
repartition_aggregations: true, | ||
repartition_windows: true, | ||
parquet_pruning: true, | ||
config_options: ConfigOptions::new(), | ||
config_options: Arc::new(RwLock::new(ConfigOptions::new())), | ||
// Assume no extensions by default. | ||
extensions: HashMap::with_capacity_and_hasher( | ||
0, | ||
|
@@ -1166,14 +1167,14 @@ impl SessionConfig { | |
/// Create an execution config with config options read from the environment | ||
pub fn from_env() -> Self { | ||
Self { | ||
config_options: ConfigOptions::from_env(), | ||
config_options: Arc::new(RwLock::new(ConfigOptions::from_env())), | ||
..Default::default() | ||
} | ||
} | ||
|
||
/// Set a configuration option | ||
pub fn set(mut self, key: &str, value: ScalarValue) -> Self { | ||
self.config_options.set(key, value); | ||
pub fn set(self, key: &str, value: ScalarValue) -> Self { | ||
self.config_options.write().set(key, value); | ||
self | ||
Comment on lines
+1176
to
1178
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
|
@@ -1252,22 +1253,18 @@ impl SessionConfig { | |
/// Get the currently configured batch size | ||
pub fn batch_size(&self) -> usize { | ||
self.config_options | ||
.read() | ||
.get_u64(OPT_BATCH_SIZE) | ||
.try_into() | ||
.unwrap() | ||
} | ||
Comment on lines
1254
to
1260
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/// Get the current configuration options | ||
pub fn config_options(&self) -> &ConfigOptions { | ||
&self.config_options | ||
} | ||
|
||
/// Convert configuration options to name-value pairs with values converted to strings. Note | ||
/// that this method will eventually be deprecated and replaced by [config_options]. | ||
pub fn to_props(&self) -> HashMap<String, String> { | ||
let mut map = HashMap::new(); | ||
// copy configs from config_options | ||
for (k, v) in self.config_options.options() { | ||
for (k, v) in self.config_options.read().options() { | ||
map.insert(k.to_string(), format!("{}", v)); | ||
} | ||
map.insert( | ||
|
@@ -1420,6 +1417,7 @@ impl SessionState { | |
let default_catalog: Arc<dyn CatalogProvider> = if config.information_schema { | ||
Arc::new(CatalogWithInformationSchema::new( | ||
Arc::downgrade(&catalog_list), | ||
Arc::downgrade(&config.config_options), | ||
Arc::new(default_catalog), | ||
)) | ||
} else { | ||
|
@@ -1444,7 +1442,11 @@ impl SessionState { | |
Arc::new(ProjectionPushDown::new()), | ||
Arc::new(RewriteDisjunctivePredicate::new()), | ||
]; | ||
if config.config_options.get_bool(OPT_FILTER_NULL_JOIN_KEYS) { | ||
if config | ||
.config_options | ||
.read() | ||
.get_bool(OPT_FILTER_NULL_JOIN_KEYS) | ||
{ | ||
rules.push(Arc::new(FilterNullJoinKeys::default())); | ||
} | ||
rules.push(Arc::new(ReduceOuterJoin::new())); | ||
|
@@ -1459,10 +1461,11 @@ impl SessionState { | |
Arc::new(AggregateStatistics::new()), | ||
Arc::new(HashBuildProbeOrder::new()), | ||
]; | ||
if config.config_options.get_bool(OPT_COALESCE_BATCHES) { | ||
if config.config_options.read().get_bool(OPT_COALESCE_BATCHES) { | ||
physical_optimizers.push(Arc::new(CoalesceBatches::new( | ||
config | ||
.config_options | ||
.read() | ||
.get_u64(OPT_COALESCE_TARGET_BATCH_SIZE) | ||
.try_into() | ||
.unwrap(), | ||
|
@@ -1566,6 +1569,7 @@ impl SessionState { | |
let mut optimizer_config = OptimizerConfig::new().with_skip_failing_rules( | ||
self.config | ||
.config_options | ||
.read() | ||
.get_bool(OPT_OPTIMIZER_SKIP_FAILED_RULES), | ||
); | ||
optimizer_config.query_execution_start_time = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename settings -> df_settings