cj-zhukov commented on code in PR #20838:
URL: https://github.com/apache/datafusion/pull/20838#discussion_r2916125932
##########
datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs:
##########
@@ -38,29 +39,38 @@ pub struct DataFusion {
relative_path: PathBuf,
pb: ProgressBar,
currently_executing_sql_tracker: CurrentlyExecutingSqlTracker,
+ default_config: HashMap<String, Option<String>>,
}
impl DataFusion {
pub fn new(ctx: SessionContext, relative_path: PathBuf, pb: ProgressBar)
-> Self {
+ let default_config = SessionContext::new()
+ .state()
+ .config()
+ .options()
+ .entries()
+ .iter()
+ .map(|e| (e.key.clone(), e.value.clone()))
+ .collect();
+
Self {
ctx,
relative_path,
pb,
currently_executing_sql_tracker:
CurrentlyExecutingSqlTracker::default(),
+ default_config,
}
}
/// Add a tracker that will track the currently executed SQL statement.
///
/// This is useful for logging and debugging purposes.
pub fn with_currently_executing_sql_tracker(
- self,
+ mut self,
Review Comment:
Good catch - this change was actually required after implementing `Drop` for
`DataFusion`.
Previously this method used struct update syntax:
`Self { currently_executing_sql_tracker, ..self }`
However, once `DataFusion` implements `Drop`, moving fields out of `self` is
not allowed. This resulted in errors like: `cannot move out of type
`DataFusion`, which implements the `Drop` trait`
Changing the method to take `mut self` and update the field in place avoids
moving fields and resolves the issue.
I agree the change is not directly related to the main goal of the PR, but
it was necessary after introducing the `Drop` implementation.
--
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]