This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch 
gh-readonly-queue/main/pr-21108-7f29cb050acd055c5cb52d620282fe9cb8ac2af0
in repository https://gitbox.apache.org/repos/asf/datafusion.git

commit 98defe6f32d8671a26656abd1b10bf0209478313
Author: Yongting You <[email protected]>
AuthorDate: Wed Mar 25 04:10:45 2026 +0800

    chore: Fix all sqllogictest dangling configs (#21108)
    
    ## Which issue does this PR close?
    
    <!--
    We generally require a GitHub issue to be filed for all bug fixes and
    enhancements and this helps us generate change logs for our releases.
    You can link an issue to this PR using the GitHub syntax. For example
    `Closes #123` indicates that this PR will close issue #123.
    -->
    
    Follow up to https://github.com/apache/datafusion/pull/20838
    
    ## Rationale for this change
    
    <!--
    Why are you proposing this change? If this is already explained clearly
    in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand
    your changes and offer better suggestions for fixes.
    -->
    
    in #20838 it adds a way to check and warn about dangling config
    settings, it has detected several existing violations but has not fixed
    them:
    ```sh
    yongting@Yongtings-MacBook-Pro-2 ~/C/datafusion (cleanup-slt)> git checkout 
main
    Switched to branch 'main'
    Your branch is up to date with 'upstream/main'.
    yongting@Yongtings-MacBook-Pro-2 ~/C/datafusion (main=)> cargo test 
--profile=ci --test sqllogictests
       Compiling datafusion-sqllogictest v52.3.0 
(/Users/yongting/Code/datafusion/datafusion/sqllogictest)
        Finished `ci` profile [unoptimized] target(s) in 2.09s
         Running bin/sqllogictests.rs 
(target/ci/deps/sqllogictests-7e2a8cc6115b158a)
    Running with 14 test threads (available parallelism: 14)
    SLT file aggregate_repartition.slt left modified configuration
      datafusion.execution.target_partitions: 4 -> 1
    SLT file arrow_files.slt left modified configuration
      datafusion.sql_parser.map_string_types_to_utf8view: true -> false
    SLT file datetime/current_date_timezone.slt left modified configuration
      datafusion.execution.time_zone: NULL -> +00:00
    ...
    ```
    
    This PR does
    1. Fix all the old violations
    2. For future slt dangling configurations, it fails the test run instead
    of only warn about it.
    
    I tested to add a config statement at the end of one `slt` file, and run
    the test, it runs and failed as expected
    ```sh
    yongting@Yongtings-MacBook-Pro-2 ~/C/datafusion (cleanup-slt)> cargo test 
--profile=ci --test sqllogictests
       Compiling datafusion-sqllogictest v52.3.0 
(/Users/yongting/Code/datafusion/datafusion/sqllogictest)
        Finished `ci` profile [unoptimized] target(s) in 2.28s
         Running bin/sqllogictests.rs 
(target/ci/deps/sqllogictests-7e2a8cc6115b158a)
    Running with 14 test threads (available parallelism: 14)
    Completed 416 test files in 5 seconds
    External error: Other Error: SLT file sort_pushdown.slt left modified 
configuration
      datafusion.optimizer.max_passes: 3 -> 10
    Error: Execution("1 failures")
    error: test failed, to rerun pass `-p datafusion-sqllogictest --test 
sqllogictests`
    ```
    
    ## What changes are included in this PR?
    
    <!--
    There is no need to duplicate the description in the issue here but it
    is sometimes worth providing a summary of the individual changes in this
    PR.
    -->
    
    ## Are these changes tested?
    
    <!--
    We typically require tests for all PRs in order to:
    1. Prevent the code from being accidentally broken by subsequent changes
    4. Serve as another way to document the expected behavior of the code
    
    If tests are not included in your PR, please explain why (for example,
    are they covered by existing tests)?
    -->
    UT
    
    ## Are there any user-facing changes?
    
    <!--
    If there are user-facing changes then we may require documentation to be
    updated before approving the PR.
    -->
    
    <!--
    If there are any breaking changes to public APIs, please add the `api
    change` label.
    -->
    no
---
 datafusion/sqllogictest/bin/sqllogictests.rs       |  46 ++++++--
 .../src/engines/datafusion_engine/runner.rs        | 125 ++++++++++++++-------
 datafusion/sqllogictest/test_files/aggregate.slt   |   9 +-
 .../test_files/aggregate_repartition.slt           |   7 ++
 .../test_files/aggregate_skip_partial.slt          |  45 ++++++++
 datafusion/sqllogictest/test_files/arrow_files.slt |   4 +
 datafusion/sqllogictest/test_files/avro.slt        |   4 +
 datafusion/sqllogictest/test_files/cte.slt         |  10 ++
 .../test_files/datetime/current_date_timezone.slt  |   4 +
 .../test_files/datetime/current_time_timezone.slt  |   4 +
 datafusion/sqllogictest/test_files/delete.slt      |   4 +
 datafusion/sqllogictest/test_files/distinct_on.slt |   4 +
 .../test_files/dynamic_filter_pushdown_config.slt  |   5 +-
 datafusion/sqllogictest/test_files/explain.slt     |   3 +-
 .../sqllogictest/test_files/explain_tree.slt       |   7 ++
 .../sqllogictest/test_files/floor_preimage.slt     |   4 +
 datafusion/sqllogictest/test_files/group_by.slt    |   9 ++
 .../test_files/ident_normalization.slt             |   4 +
 .../sqllogictest/test_files/information_schema.slt |  15 +++
 .../test_files/information_schema_columns.slt      |  10 ++
 .../information_schema_multiple_catalogs.slt       |  10 ++
 .../test_files/information_schema_table_types.slt  |   4 +
 datafusion/sqllogictest/test_files/insert.slt      |   7 ++
 .../sqllogictest/test_files/insert_to_external.slt |   7 ++
 .../test_files/join_limit_pushdown.slt             |  13 +++
 datafusion/sqllogictest/test_files/join_only.slt   |   4 +
 datafusion/sqllogictest/test_files/joins.slt       |  27 +++++
 datafusion/sqllogictest/test_files/limit.slt       |  16 +++
 .../sqllogictest/test_files/limit_pruning.slt      |   4 +
 .../test_files/limit_single_row_batches.slt        |   9 ++
 .../test_files/listing_table_statistics.slt        |   5 +-
 .../test_files/optimizer_group_by_constant.slt     |  10 ++
 datafusion/sqllogictest/test_files/order.slt       |  24 ++++
 datafusion/sqllogictest/test_files/parquet.slt     |  20 ++++
 .../test_files/parquet_sorted_statistics.slt       |  13 +++
 .../sqllogictest/test_files/parquet_statistics.slt |  11 +-
 .../sqllogictest/test_files/pipe_operator.slt      |   4 +
 datafusion/sqllogictest/test_files/predicates.slt  |   4 +
 .../test_files/preserve_file_partitioning.slt      |  13 +++
 .../test_files/projection_pushdown.slt             |  12 +-
 .../test_files/push_down_filter_parquet.slt        |   7 ++
 .../test_files/push_down_filter_regression.slt     |  22 ++++
 .../test_files/push_down_filter_unnest.slt         |   4 +
 datafusion/sqllogictest/test_files/repartition.slt |  10 ++
 .../sqllogictest/test_files/repartition_scan.slt   |   7 ++
 .../test_files/repartition_subset_satisfaction.slt |  16 +++
 datafusion/sqllogictest/test_files/select.slt      |  10 ++
 .../sqllogictest/test_files/set_variable.slt       |  10 ++
 .../sqllogictest/test_files/sort_merge_join.slt    |   4 +
 .../sqllogictest/test_files/sort_pushdown.slt      |  18 ++-
 .../sqllogictest/test_files/string/string_view.slt |   4 +
 datafusion/sqllogictest/test_files/struct.slt      |   4 +
 datafusion/sqllogictest/test_files/subquery.slt    |   7 ++
 datafusion/sqllogictest/test_files/tpch/tpch.slt   |   4 +
 datafusion/sqllogictest/test_files/union.slt       |   4 +
 datafusion/sqllogictest/test_files/update.slt      |   4 +
 datafusion/sqllogictest/test_files/window.slt      |  24 ++++
 .../test_files/window_topk_pushdown.slt            |  11 +-
 58 files changed, 645 insertions(+), 65 deletions(-)

diff --git a/datafusion/sqllogictest/bin/sqllogictests.rs 
b/datafusion/sqllogictest/bin/sqllogictests.rs
index 38a7635042..6edc2e9978 100644
--- a/datafusion/sqllogictest/bin/sqllogictests.rs
+++ b/datafusion/sqllogictest/bin/sqllogictests.rs
@@ -47,8 +47,8 @@ use std::fs;
 use std::io::{IsTerminal, stderr, stdout};
 use std::path::{Path, PathBuf};
 use std::str::FromStr;
-use std::sync::Arc;
 use std::sync::atomic::{AtomicUsize, Ordering};
+use std::sync::{Arc, Mutex};
 use std::time::Duration;
 
 #[cfg(feature = "postgres")]
@@ -76,6 +76,19 @@ struct FileTiming {
     elapsed: Duration,
 }
 
+type DataFusionConfigChangeErrors = Arc<Mutex<Vec<String>>>;
+
+fn config_change_result(
+    config_change_errors: &DataFusionConfigChangeErrors,
+) -> Result<()> {
+    let errors = config_change_errors.lock().unwrap();
+    if errors.is_empty() {
+        Ok(())
+    } else {
+        Err(DataFusionError::External(errors.join("\n\n").into()))
+    }
+}
+
 pub fn main() -> Result<()> {
     tokio::runtime::Builder::new_multi_thread()
         .enable_all()
@@ -482,7 +495,7 @@ async fn run_test_file_substrait_round_trip(
     runner.with_column_validator(strict_column_validator);
     runner.with_normalizer(value_normalizer);
     runner.with_validator(validator);
-    let res = run_file_in_runner(path, runner, filters, colored_output).await;
+    let res = run_file_in_runner(path, &mut runner, filters, 
colored_output).await;
     pb.finish_and_clear();
     res
 }
@@ -512,26 +525,37 @@ async fn run_test_file(
     pb.set_style(mp_style);
     pb.set_message(format!("{:?}", &relative_path));
 
+    // If DataFusion configuration has changed during test file runs, errors 
will be
+    // pushed to this vec.
+    // HACK: managed externally because `sqllogictest` is an external 
dependency, and
+    // it doesn't have an API to directly access the inner runner.
+    let config_change_errors = Arc::new(Mutex::new(Vec::new()));
     let mut runner = sqllogictest::Runner::new(|| async {
         Ok(DataFusion::new(
             test_ctx.session_ctx().clone(),
             relative_path.clone(),
             pb.clone(),
         )
-        
.with_currently_executing_sql_tracker(currently_executing_sql_tracker.clone()))
+        
.with_currently_executing_sql_tracker(currently_executing_sql_tracker.clone())
+        .with_config_change_errors(Arc::clone(&config_change_errors)))
     });
     runner.add_label("Datafusion");
     runner.with_column_validator(strict_column_validator);
     runner.with_normalizer(value_normalizer);
     runner.with_validator(validator);
-    let result = run_file_in_runner(path, runner, filters, 
colored_output).await;
+    let result = run_file_in_runner(path, &mut runner, filters, 
colored_output).await;
     pb.finish_and_clear();
-    result
+
+    result?;
+
+    // If there was no correctness error, check that the config is unchanged.
+    runner.shutdown_async().await;
+    config_change_result(&config_change_errors)
 }
 
 async fn run_file_in_runner<D: AsyncDB, M: MakeConnection<Conn = D>>(
     path: PathBuf,
-    mut runner: sqllogictest::Runner<D, M>,
+    runner: &mut sqllogictest::Runner<D, M>,
     filters: &[Filter],
     colored_output: bool,
 ) -> Result<()> {
@@ -644,7 +668,7 @@ async fn run_test_file_with_postgres(
     runner.with_column_validator(strict_column_validator);
     runner.with_normalizer(value_normalizer);
     runner.with_validator(validator);
-    let result = run_file_in_runner(path, runner, filters, false).await;
+    let result = run_file_in_runner(path, &mut runner, filters, false).await;
     pb.finish_and_clear();
     result
 }
@@ -688,13 +712,15 @@ async fn run_complete_file(
     pb.set_style(mp_style);
     pb.set_message(format!("{:?}", &relative_path));
 
+    let config_change_errors = Arc::new(Mutex::new(Vec::new()));
     let mut runner = sqllogictest::Runner::new(|| async {
         Ok(DataFusion::new(
             test_ctx.session_ctx().clone(),
             relative_path.clone(),
             pb.clone(),
         )
-        
.with_currently_executing_sql_tracker(currently_executing_sql_tracker.clone()))
+        
.with_currently_executing_sql_tracker(currently_executing_sql_tracker.clone())
+        .with_config_change_errors(Arc::clone(&config_change_errors)))
     });
 
     let col_separator = " ";
@@ -712,7 +738,9 @@ async fn run_complete_file(
 
     pb.finish_and_clear();
 
-    res
+    res?;
+    runner.shutdown_async().await;
+    config_change_result(&config_change_errors)
 }
 
 #[cfg(feature = "postgres")]
diff --git a/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs 
b/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs
index c682d081f8..08facc4800 100644
--- a/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs
+++ b/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs
@@ -16,7 +16,7 @@
 // under the License.
 
 use std::collections::HashMap;
-use std::sync::Arc;
+use std::sync::{Arc, Mutex};
 use std::{path::PathBuf, time::Duration};
 
 use super::{DFSqlLogicTestError, error::Result, normalize};
@@ -40,6 +40,7 @@ pub struct DataFusion {
     pb: ProgressBar,
     currently_executing_sql_tracker: CurrentlyExecutingSqlTracker,
     default_config: HashMap<String, Option<String>>,
+    config_change_errors: Option<Arc<Mutex<Vec<String>>>>,
 }
 
 impl DataFusion {
@@ -59,6 +60,7 @@ impl DataFusion {
             pb,
             currently_executing_sql_tracker: 
CurrentlyExecutingSqlTracker::default(),
             default_config,
+            config_change_errors: None,
         }
     }
 
@@ -73,6 +75,14 @@ impl DataFusion {
         self
     }
 
+    pub fn with_config_change_errors(
+        mut self,
+        config_change_errors: Arc<Mutex<Vec<String>>>,
+    ) -> Self {
+        self.config_change_errors = Some(config_change_errors);
+        self
+    }
+
     fn update_slow_count(&self) {
         let msg = self.pb.message();
         let split: Vec<&str> = msg.split(" ").collect();
@@ -88,6 +98,43 @@ impl DataFusion {
         self.pb
             .set_message(format!("{} - {} took > 500 ms", split[0], 
current_count));
     }
+
+    pub fn validate_config_unchanged(&mut self) -> Result<()> {
+        let mut changed = false;
+        let mut message = format!(
+            "SLT file {} left modified configuration",
+            self.relative_path.display()
+        );
+
+        for entry in self.ctx.state().config().options().entries() {
+            let default_entry = self.default_config.remove(&entry.key);
+
+            if let Some(default_entry) = default_entry
+                && default_entry.as_ref() != entry.value.as_ref()
+            {
+                changed = true;
+
+                let default = default_entry.as_deref().unwrap_or("NULL");
+                let current = entry.value.as_deref().unwrap_or("NULL");
+
+                message
+                    .push_str(&format!("\n  {}: {} -> {}", entry.key, default, 
current));
+            }
+        }
+
+        for (key, value) in &self.default_config {
+            changed = true;
+
+            let default = value.as_deref().unwrap_or("NULL");
+            message.push_str(&format!("\n  {key}: {default} -> NULL"));
+        }
+
+        if changed {
+            Err(DFSqlLogicTestError::Other(message))
+        } else {
+            Ok(())
+        }
+    }
 }
 
 #[async_trait]
@@ -142,48 +189,12 @@ impl sqllogictest::AsyncDB for DataFusion {
         tokio::time::sleep(dur).await;
     }
 
-    async fn shutdown(&mut self) {}
-}
-
-impl Drop for DataFusion {
-    fn drop(&mut self) {
-        let mut changed = false;
-
-        for e in self.ctx.state().config().options().entries() {
-            let default_entry = self.default_config.remove(&e.key);
-
-            if let Some(default_entry) = default_entry
-                && default_entry.as_ref() != e.value.as_ref()
-            {
-                if !changed {
-                    changed = true;
-                    self.pb.println(format!(
-                        "SLT file {} left modified configuration",
-                        self.relative_path.display()
-                    ));
-                }
-
-                let default = default_entry.as_deref().unwrap_or("NULL");
-                let current = e.value.as_deref().unwrap_or("NULL");
-
-                self.pb
-                    .println(format!("  {}: {} -> {}", e.key, default, 
current));
-            }
-        }
-
-        // Any remaining entries were present initially but removed during 
execution
-        for (key, value) in &self.default_config {
-            if !changed {
-                changed = true;
-                self.pb.println(format!(
-                    "SLT file {} left modified configuration",
-                    self.relative_path.display()
-                ));
-            }
-
-            let default = value.as_deref().unwrap_or("NULL");
-
-            self.pb.println(format!("  {key}: {default} -> NULL"));
+    /// Shutdown and check no DataFusion configuration has changed during test
+    async fn shutdown(&mut self) {
+        if let Some(config_change_errors) = self.config_change_errors.clone()
+            && let Err(error) = self.validate_config_unchanged()
+        {
+            config_change_errors.lock().unwrap().push(error.to_string());
         }
     }
 }
@@ -209,3 +220,31 @@ async fn run_query(
         Ok(DBOutput::Rows { types, rows })
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use sqllogictest::AsyncDB;
+
+    #[tokio::test]
+    async fn validate_config_unchanged_detects_modified_config() {
+        let ctx = SessionContext::new();
+        let default_batch_size = 
ctx.state().config().options().execution.batch_size;
+        let mut runner =
+            DataFusion::new(ctx, PathBuf::from("test.slt"), 
ProgressBar::hidden());
+
+        <DataFusion as AsyncDB>::run(
+            &mut runner,
+            "SET datafusion.execution.batch_size = 2048",
+        )
+        .await
+        .unwrap();
+
+        let error = runner.validate_config_unchanged().unwrap_err();
+        let message = error.to_string();
+
+        assert!(message.contains("test.slt left modified configuration"));
+        assert!(message.contains("datafusion.execution.batch_size"));
+        assert!(message.contains(&format!("{default_batch_size} -> 2048")));
+    }
+}
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt 
b/datafusion/sqllogictest/test_files/aggregate.slt
index cf894a494a..1f2a81d334 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -8778,9 +8778,12 @@ ORDER BY g;
 2 2 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
 3 2 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
 
-statement ok
-DROP TABLE stream_test;
+# Config reset
 
-# Restore default target partitions
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
 statement ok
 set datafusion.execution.target_partitions = 4;
+
+statement ok
+DROP TABLE stream_test;
diff --git a/datafusion/sqllogictest/test_files/aggregate_repartition.slt 
b/datafusion/sqllogictest/test_files/aggregate_repartition.slt
index eeece78623..1f1e726811 100644
--- a/datafusion/sqllogictest/test_files/aggregate_repartition.slt
+++ b/datafusion/sqllogictest/test_files/aggregate_repartition.slt
@@ -128,3 +128,10 @@ physical_plan
 01)ProjectionExec: expr=[env@0 as env, count(Int64(1))@1 as count(*)]
 02)--AggregateExec: mode=Single, gby=[env@0 as env], aggr=[count(Int64(1))]
 03)----DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/aggregate_repartition/dim.parquet]]},
 projection=[env], file_type=parquet
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+SET datafusion.execution.target_partitions = 4;
diff --git a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt 
b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt
index c16a6f4424..e12ac5782e 100644
--- a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt
+++ b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt
@@ -216,6 +216,21 @@ c true false NULL
 d NULL false NULL
 e true false NULL
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_ratio_threshold;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_rows_threshold;
+
 # Prepare settings to always skip aggregation after couple of batches
 statement ok
 set datafusion.execution.skip_partial_aggregation_probe_rows_threshold = 10;
@@ -693,6 +708,21 @@ ORDER BY i;
 2 66
 3 33
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_ratio_threshold;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_rows_threshold;
+
 statement ok
 DROP TABLE decimal_table;
 
@@ -738,5 +768,20 @@ SELECT bool_and(c1), bool_and(c2), bool_and(c3), 
bool_and(c4), bool_and(c5), boo
 ----
 true false false false false true false NULL
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_ratio_threshold;
+
+statement ok
+reset datafusion.execution.skip_partial_aggregation_probe_rows_threshold;
+
 statement ok
 DROP TABLE aggregate_test_100_bool
diff --git a/datafusion/sqllogictest/test_files/arrow_files.slt 
b/datafusion/sqllogictest/test_files/arrow_files.slt
index c3bc967baf..94e1507388 100644
--- a/datafusion/sqllogictest/test_files/arrow_files.slt
+++ b/datafusion/sqllogictest/test_files/arrow_files.slt
@@ -388,3 +388,7 @@ physical_plan DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/datafusion/
 # querying corrupted stream format should result in error
 query error DataFusion error: Arrow error: Parser error: Unsupported message 
header type in IPC stream: 'NONE'
 SELECT * FROM arrow_stream_corrupted_metadata_length
+
+# Config reset
+statement ok
+RESET datafusion.sql_parser.map_string_types_to_utf8view;
diff --git a/datafusion/sqllogictest/test_files/avro.slt 
b/datafusion/sqllogictest/test_files/avro.slt
index 2ad60c0082..6e580006fe 100644
--- a/datafusion/sqllogictest/test_files/avro.slt
+++ b/datafusion/sqllogictest/test_files/avro.slt
@@ -267,3 +267,7 @@ SELECT id, string_col, int_col, bigint_col FROM 
alltypes_plain ORDER BY id LIMIT
 2 0 0 0
 3 1 1 10
 4 0 0 0
+
+# Config reset
+statement ok
+reset datafusion.sql_parser.map_string_types_to_utf8view;
\ No newline at end of file
diff --git a/datafusion/sqllogictest/test_files/cte.slt 
b/datafusion/sqllogictest/test_files/cte.slt
index a0a541a826..d56b6f5203 100644
--- a/datafusion/sqllogictest/test_files/cte.slt
+++ b/datafusion/sqllogictest/test_files/cte.slt
@@ -1232,3 +1232,13 @@ explain WITH RECURSIVE numbers AS (
   UNION ALL
   select n + 1 FROM numbers WHERE n < 10
 ) select * from numbers;
+
+# Config reset
+statement ok
+RESET datafusion.execution.batch_size;
+
+statement ok
+RESET datafusion.execution.enable_recursive_ctes;
+
+statement ok
+RESET datafusion.sql_parser.enable_ident_normalization;
diff --git 
a/datafusion/sqllogictest/test_files/datetime/current_date_timezone.slt 
b/datafusion/sqllogictest/test_files/datetime/current_date_timezone.slt
index 1b9c3cddee..180b79c9b1 100644
--- a/datafusion/sqllogictest/test_files/datetime/current_date_timezone.slt
+++ b/datafusion/sqllogictest/test_files/datetime/current_date_timezone.slt
@@ -78,3 +78,7 @@ query B
 SELECT current_date() = today();
 ----
 true
+
+# Config reset
+statement ok
+RESET datafusion.execution.time_zone;
diff --git 
a/datafusion/sqllogictest/test_files/datetime/current_time_timezone.slt 
b/datafusion/sqllogictest/test_files/datetime/current_time_timezone.slt
index c80c4b51d5..e61dc84735 100644
--- a/datafusion/sqllogictest/test_files/datetime/current_time_timezone.slt
+++ b/datafusion/sqllogictest/test_files/datetime/current_time_timezone.slt
@@ -98,3 +98,7 @@ query B
 SELECT current_time() = current_time();
 ----
 true
+
+# Config reset
+statement ok
+RESET datafusion.execution.time_zone;
diff --git a/datafusion/sqllogictest/test_files/delete.slt 
b/datafusion/sqllogictest/test_files/delete.slt
index b01eb6f5e9..76db46f138 100644
--- a/datafusion/sqllogictest/test_files/delete.slt
+++ b/datafusion/sqllogictest/test_files/delete.slt
@@ -140,3 +140,7 @@ logical_plan
 physical_plan
 01)CooperativeExec
 02)--DmlResultExec: rows_affected=0
+
+# Config reset
+statement ok
+RESET datafusion.optimizer.max_passes;
diff --git a/datafusion/sqllogictest/test_files/distinct_on.slt 
b/datafusion/sqllogictest/test_files/distinct_on.slt
index 23a269b525..5b18915080 100644
--- a/datafusion/sqllogictest/test_files/distinct_on.slt
+++ b/datafusion/sqllogictest/test_files/distinct_on.slt
@@ -189,5 +189,9 @@ logical_plan
 01)Aggregate: groupBy=[[t.a, t.b]], aggr=[[]]
 02)--TableScan: t projection=[a, b]
 
+# Config reset
+statement ok
+RESET datafusion.explain.logical_plan_only;
+
 statement ok
 drop table t;
diff --git 
a/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt 
b/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
index d5202a1d95..5a1058b8a2 100644
--- a/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
+++ b/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
@@ -813,7 +813,7 @@ DROP TABLE agg_source;
 statement ok
 DROP TABLE agg_parquet;
 
-# Reset configs to defaults
+# Config reset
 statement ok
 SET datafusion.optimizer.enable_topk_dynamic_filter_pushdown = true;
 
@@ -825,3 +825,6 @@ SET 
datafusion.optimizer.enable_aggregate_dynamic_filter_pushdown = true;
 
 statement ok
 SET datafusion.optimizer.enable_dynamic_filter_pushdown = true;
+
+statement ok
+RESET datafusion.execution.parquet.max_row_group_size;
diff --git a/datafusion/sqllogictest/test_files/explain.slt 
b/datafusion/sqllogictest/test_files/explain.slt
index 9916892058..467afe7b6c 100644
--- a/datafusion/sqllogictest/test_files/explain.slt
+++ b/datafusion/sqllogictest/test_files/explain.slt
@@ -384,8 +384,9 @@ physical_plan_with_stats DataSourceExec: file_groups={1 
group: [[WORKSPACE_ROOT/
 physical_plan_with_schema DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/parquet-testing/data/alltypes_plain.parquet]]}, 
projection=[id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, 
float_col, double_col, date_string_col, string_col, timestamp_col], limit=10, 
file_type=parquet, schema=[id:Int32;N, bool_col:Boolean;N, tinyint_col:Int32;N, 
smallint_col:Int32;N, int_col:Int32;N, bigint_col:Int64;N, float_col:Float32;N, 
double_col:Float64;N, date_string_col:BinaryView;N, [...]
 
 
+# Config reset
 statement ok
-set datafusion.execution.collect_statistics = false;
+reset datafusion.execution.collect_statistics;
 
 # Explain ArrayFunctions
 
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt 
b/datafusion/sqllogictest/test_files/explain_tree.slt
index 3a183a7357..e188313e22 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -2077,3 +2077,10 @@ physical_plan
 
 statement ok
 DROP TABLE t
+
+# Config reset
+statement ok
+RESET datafusion.explain.format;
+
+statement ok
+RESET datafusion.explain.tree_maximum_render_width;
diff --git a/datafusion/sqllogictest/test_files/floor_preimage.slt 
b/datafusion/sqllogictest/test_files/floor_preimage.slt
index 93302b3d7a..960b966ebb 100644
--- a/datafusion/sqllogictest/test_files/floor_preimage.slt
+++ b/datafusion/sqllogictest/test_files/floor_preimage.slt
@@ -300,6 +300,10 @@ logical_plan
 01)Filter: test_data.float_val < Float64(6)
 02)--TableScan: test_data projection=[id, float_val, int_val, decimal_val]
 
+# Config reset
+statement ok
+RESET datafusion.explain.logical_plan_only;
+
 ##########
 ## Cleanup
 ##########
diff --git a/datafusion/sqllogictest/test_files/group_by.slt 
b/datafusion/sqllogictest/test_files/group_by.slt
index 9653988a68..4b1f663bb8 100644
--- a/datafusion/sqllogictest/test_files/group_by.slt
+++ b/datafusion/sqllogictest/test_files/group_by.slt
@@ -5600,5 +5600,14 @@ physical_plan
 01)AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b], aggr=[]
 02)--DataSourceExec: partitions=1, partition_sizes=[0]
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
 statement count 0
 drop table t;
diff --git a/datafusion/sqllogictest/test_files/ident_normalization.slt 
b/datafusion/sqllogictest/test_files/ident_normalization.slt
index ac2f460ebc..b1bdb1d882 100644
--- a/datafusion/sqllogictest/test_files/ident_normalization.slt
+++ b/datafusion/sqllogictest/test_files/ident_normalization.slt
@@ -137,6 +137,10 @@ HelloWorld
 statement ok
 set datafusion.sql_parser.enable_ident_normalization = true;
 
+# Config reset
+statement ok
+RESET datafusion.catalog.information_schema;
+
 ##########
 ## Constraint Column Name Normalization
 ##########
diff --git a/datafusion/sqllogictest/test_files/information_schema.slt 
b/datafusion/sqllogictest/test_files/information_schema.slt
index f843b2e63c..2da823421d 100644
--- a/datafusion/sqllogictest/test_files/information_schema.slt
+++ b/datafusion/sqllogictest/test_files/information_schema.slt
@@ -870,3 +870,18 @@ date_trunc Timestamp(ns, "+TZ") [precision, expression] 
[String, Timestamp(ns, "
 
 statement ok
 show functions
+
+# Config reset
+statement ok
+reset datafusion.catalog.information_schema;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.execution.planning_concurrency;
+
+statement ok
+reset datafusion.execution.parquet.created_by;
diff --git a/datafusion/sqllogictest/test_files/information_schema_columns.slt 
b/datafusion/sqllogictest/test_files/information_schema_columns.slt
index c733b3baa7..76ec8f0a73 100644
--- a/datafusion/sqllogictest/test_files/information_schema_columns.slt
+++ b/datafusion/sqllogictest/test_files/information_schema_columns.slt
@@ -51,3 +51,13 @@ drop table t1
 
 statement ok
 drop table table_with_many_types
+
+# Config reset
+statement ok
+RESET datafusion.catalog.default_catalog;
+
+statement ok
+RESET datafusion.catalog.default_schema;
+
+statement ok
+RESET datafusion.catalog.information_schema;
diff --git 
a/datafusion/sqllogictest/test_files/information_schema_multiple_catalogs.slt 
b/datafusion/sqllogictest/test_files/information_schema_multiple_catalogs.slt
index 0594aa7cfc..f57ecbc32a 100644
--- 
a/datafusion/sqllogictest/test_files/information_schema_multiple_catalogs.slt
+++ 
b/datafusion/sqllogictest/test_files/information_schema_multiple_catalogs.slt
@@ -121,3 +121,13 @@ drop table t1
 
 statement ok
 drop table t2
+
+# Config reset
+statement ok
+RESET datafusion.catalog.default_catalog;
+
+statement ok
+RESET datafusion.catalog.default_schema;
+
+statement ok
+RESET datafusion.catalog.information_schema;
diff --git 
a/datafusion/sqllogictest/test_files/information_schema_table_types.slt 
b/datafusion/sqllogictest/test_files/information_schema_table_types.slt
index 5650d537b0..858327fb20 100644
--- a/datafusion/sqllogictest/test_files/information_schema_table_types.slt
+++ b/datafusion/sqllogictest/test_files/information_schema_table_types.slt
@@ -47,6 +47,10 @@ datafusion public temp LOCAL TEMPORARY
 
 # Cleanup
 
+# Config reset
+statement ok
+RESET datafusion.catalog.information_schema;
+
 statement ok
 drop table physical
 
diff --git a/datafusion/sqllogictest/test_files/insert.slt 
b/datafusion/sqllogictest/test_files/insert.slt
index e7b9e77dfe..c807f73d60 100644
--- a/datafusion/sqllogictest/test_files/insert.slt
+++ b/datafusion/sqllogictest/test_files/insert.slt
@@ -460,3 +460,10 @@ select * from unsigned_bigint_test
 
 statement ok
 drop table unsigned_bigint_test
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
diff --git a/datafusion/sqllogictest/test_files/insert_to_external.slt 
b/datafusion/sqllogictest/test_files/insert_to_external.slt
index 4702b0b9ca..75476c0278 100644
--- a/datafusion/sqllogictest/test_files/insert_to_external.slt
+++ b/datafusion/sqllogictest/test_files/insert_to_external.slt
@@ -693,3 +693,10 @@ CREATE EXTERNAL TABLE test_column_defaults(
   b int default a+1
 ) STORED AS parquet
 LOCATION 'test_files/scratch/insert_to_external/external_parquet_table_q7/';
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
diff --git a/datafusion/sqllogictest/test_files/join_limit_pushdown.slt 
b/datafusion/sqllogictest/test_files/join_limit_pushdown.slt
index 6bb23c1b4c..24d48e5661 100644
--- a/datafusion/sqllogictest/test_files/join_limit_pushdown.slt
+++ b/datafusion/sqllogictest/test_files/join_limit_pushdown.slt
@@ -259,6 +259,19 @@ SELECT t1.a, t2.x FROM t1 INNER JOIN t2 ON t1.a = t2.x 
LIMIT 100;
 2 2
 3 3
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.explain.logical_plan_only;
+
+statement ok
+reset datafusion.optimizer.prefer_hash_join;
+
 statement ok
 DROP TABLE t1;
 
diff --git a/datafusion/sqllogictest/test_files/join_only.slt 
b/datafusion/sqllogictest/test_files/join_only.slt
index b2b6a1fa9b..1c04d0123b 100644
--- a/datafusion/sqllogictest/test_files/join_only.slt
+++ b/datafusion/sqllogictest/test_files/join_only.slt
@@ -16,3 +16,7 @@
 # under the License.
 
 include ./join.slt.part
+
+# Config reset
+statement ok
+RESET datafusion.optimizer.repartition_joins;
diff --git a/datafusion/sqllogictest/test_files/joins.slt 
b/datafusion/sqllogictest/test_files/joins.slt
index 36c6581f76..fd9a26721a 100644
--- a/datafusion/sqllogictest/test_files/joins.slt
+++ b/datafusion/sqllogictest/test_files/joins.slt
@@ -5461,6 +5461,33 @@ FROM t;
 ----
 1
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.explain.logical_plan_only;
+
+statement ok
+reset datafusion.explain.physical_plan_only;
+
+statement ok
+reset datafusion.optimizer.repartition_joins;
+
+statement ok
+reset datafusion.optimizer.prefer_hash_join;
+
+statement ok
+reset datafusion.optimizer.prefer_existing_sort;
+
+statement ok
+reset datafusion.optimizer.enable_piecewise_merge_join;
+
 statement count 0
 DROP TABLE t1;
 
diff --git a/datafusion/sqllogictest/test_files/limit.slt 
b/datafusion/sqllogictest/test_files/limit.slt
index ff3c49485a..b42205baf6 100644
--- a/datafusion/sqllogictest/test_files/limit.slt
+++ b/datafusion/sqllogictest/test_files/limit.slt
@@ -865,6 +865,22 @@ limit 1000;
 ----
 1
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.explain.show_sizes;
+
+statement ok
+reset datafusion.explain.logical_plan_only;
+
+statement ok
+reset datafusion.optimizer.repartition_file_min_size;
+
 # Tear down test_filter_with_limit table:
 statement ok
 DROP TABLE test_limit_with_partitions;
diff --git a/datafusion/sqllogictest/test_files/limit_pruning.slt 
b/datafusion/sqllogictest/test_files/limit_pruning.slt
index 72672b707d..34acb98f60 100644
--- a/datafusion/sqllogictest/test_files/limit_pruning.slt
+++ b/datafusion/sqllogictest/test_files/limit_pruning.slt
@@ -79,3 +79,7 @@ drop table tracking_data;
 
 statement ok
 reset datafusion.explain.analyze_level;
+
+# Config reset
+statement ok
+RESET datafusion.execution.parquet.pushdown_filters;
diff --git a/datafusion/sqllogictest/test_files/limit_single_row_batches.slt 
b/datafusion/sqllogictest/test_files/limit_single_row_batches.slt
index 9f626816e2..6b5368620c 100644
--- a/datafusion/sqllogictest/test_files/limit_single_row_batches.slt
+++ b/datafusion/sqllogictest/test_files/limit_single_row_batches.slt
@@ -18,5 +18,14 @@ SELECT COUNT(*) FROM (SELECT i FROM filter_limit WHERE i <> 
0 LIMIT 1);
 ----
 1
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
 statement ok
 DROP TABLE filter_limit;
diff --git a/datafusion/sqllogictest/test_files/listing_table_statistics.slt 
b/datafusion/sqllogictest/test_files/listing_table_statistics.slt
index 4298320d4a..4b2aa0f563 100644
--- a/datafusion/sqllogictest/test_files/listing_table_statistics.slt
+++ b/datafusion/sqllogictest/test_files/listing_table_statistics.slt
@@ -40,8 +40,9 @@ physical_plan DataSourceExec: file_groups={2 groups: 
[[WORKSPACE_ROOT/datafusion
 statement ok
 drop table t;
 
+# Config reset
 statement ok
-set datafusion.execution.collect_statistics = false;
+reset datafusion.execution.collect_statistics;
 
 statement ok
-set datafusion.explain.show_statistics = false;
+reset datafusion.explain.show_statistics;
diff --git a/datafusion/sqllogictest/test_files/optimizer_group_by_constant.slt 
b/datafusion/sqllogictest/test_files/optimizer_group_by_constant.slt
index de6a153f58..da1e7de22b 100644
--- a/datafusion/sqllogictest/test_files/optimizer_group_by_constant.slt
+++ b/datafusion/sqllogictest/test_files/optimizer_group_by_constant.slt
@@ -116,3 +116,13 @@ logical_plan
 01)Aggregate: groupBy=[[random()]], aggr=[[]]
 02)--SubqueryAlias: t
 03)----TableScan: test_table projection=[]
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.explain.logical_plan_only;
diff --git a/datafusion/sqllogictest/test_files/order.slt 
b/datafusion/sqllogictest/test_files/order.slt
index 892a42ad61..e6f6e048a2 100644
--- a/datafusion/sqllogictest/test_files/order.slt
+++ b/datafusion/sqllogictest/test_files/order.slt
@@ -1632,3 +1632,27 @@ EXPLAIN SELECT * from ordered ORDER BY a;
 physical_plan
 01)SortExec: expr=[a@0 ASC NULLS LAST], preserve_partitioning=[false]
 02)--DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/datafusion/sqllogictest/data/composite_order.csv]]}, 
projection=[a, b], output_ordering=[a@0 + b@1 ASC NULLS LAST], file_type=csv, 
has_header=true
+
+# Config reset
+statement ok
+reset datafusion.catalog.information_schema;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.repartition_sorts;
+
+statement ok
+reset datafusion.execution.use_row_number_estimates_to_optimize_partitioning;
+
+statement ok
+reset datafusion.explain.physical_plan_only;
+
+statement ok
+reset datafusion.sql_parser.default_null_ordering;
+
+statement ok
+reset datafusion.sql_parser.dialect;
diff --git a/datafusion/sqllogictest/test_files/parquet.slt 
b/datafusion/sqllogictest/test_files/parquet.slt
index be713b963b..781d0b00a5 100644
--- a/datafusion/sqllogictest/test_files/parquet.slt
+++ b/datafusion/sqllogictest/test_files/parquet.slt
@@ -887,5 +887,25 @@ WHERE b = 2;
 ----
 2
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.runtime.list_files_cache_limit;
+
+statement ok
+reset datafusion.execution.listing_table_ignore_subdirectory;
+
+statement ok
+reset datafusion.execution.parquet.coerce_int96;
+
+# Config reset
+statement ok
+RESET datafusion.catalog.create_default_catalog_and_schema;
+
 statement ok
 DROP TABLE t;
diff --git a/datafusion/sqllogictest/test_files/parquet_sorted_statistics.slt 
b/datafusion/sqllogictest/test_files/parquet_sorted_statistics.slt
index fd3a40ca17..a4a613e383 100644
--- a/datafusion/sqllogictest/test_files/parquet_sorted_statistics.slt
+++ b/datafusion/sqllogictest/test_files/parquet_sorted_statistics.slt
@@ -275,3 +275,16 @@ logical_plan
 physical_plan
 01)SortPreservingMergeExec: [constant_col@0 ASC NULLS LAST]
 02)--DataSourceExec: file_groups={2 groups: 
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet_sorted_statistics/test_table/partition_col=A/0.parquet,
 
WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet_sorted_statistics/test_table/partition_col=B/1.parquet],
 
[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet_sorted_statistics/test_table/partition_col=C/2.parquet]]},
 projection=[constant_col], output_ordering=[constant_col@0 ASC NULLS LAST], 
[...]
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.execution.collect_statistics;
+
+statement ok
+reset datafusion.execution.split_file_groups_by_statistics;
diff --git a/datafusion/sqllogictest/test_files/parquet_statistics.slt 
b/datafusion/sqllogictest/test_files/parquet_statistics.slt
index 8c77fb96ba..1a0e004a63 100644
--- a/datafusion/sqllogictest/test_files/parquet_statistics.slt
+++ b/datafusion/sqllogictest/test_files/parquet_statistics.slt
@@ -92,7 +92,6 @@ physical_plan
 statement ok
 DROP TABLE test_table;
 
-
 ######
 # When the setting is false, the statistics are NOT gathered
 ######
@@ -117,3 +116,13 @@ physical_plan
 # cleanup
 statement ok
 DROP TABLE test_table;
+
+# Config reset
+statement ok
+RESET datafusion.execution.collect_statistics;
+
+statement ok
+RESET datafusion.explain.physical_plan_only;
+
+statement ok
+RESET datafusion.explain.show_statistics;
diff --git a/datafusion/sqllogictest/test_files/pipe_operator.slt 
b/datafusion/sqllogictest/test_files/pipe_operator.slt
index 5908b3d6b2..406ddafc7b 100644
--- a/datafusion/sqllogictest/test_files/pipe_operator.slt
+++ b/datafusion/sqllogictest/test_files/pipe_operator.slt
@@ -195,3 +195,7 @@ query TII
 ----
 apples 2 123
 bananas 5 NULL
+
+# Config reset
+statement ok
+RESET datafusion.sql_parser.dialect;
diff --git a/datafusion/sqllogictest/test_files/predicates.slt 
b/datafusion/sqllogictest/test_files/predicates.slt
index 7d33814b8b..8bc2ca465e 100644
--- a/datafusion/sqllogictest/test_files/predicates.slt
+++ b/datafusion/sqllogictest/test_files/predicates.slt
@@ -864,5 +864,9 @@ WHERE NULL NOT IN (SELECT * FROM empty); -- all rows should 
be returned
 ----
 1
 
+# Config reset
+statement ok
+RESET datafusion.catalog.information_schema;
+
 statement ok
 drop table t;
diff --git a/datafusion/sqllogictest/test_files/preserve_file_partitioning.slt 
b/datafusion/sqllogictest/test_files/preserve_file_partitioning.slt
index 297094fab1..cfa71ddfcc 100644
--- a/datafusion/sqllogictest/test_files/preserve_file_partitioning.slt
+++ b/datafusion/sqllogictest/test_files/preserve_file_partitioning.slt
@@ -708,6 +708,19 @@ C prod 2017.6
 # CLEANUP
 ##########
 
+# Config reset (4 is hard-coded from SLT runner setting)
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.preserve_file_partitions;
+
+statement ok
+reset datafusion.optimizer.hash_join_single_partition_threshold;
+
+statement ok
+reset datafusion.optimizer.hash_join_single_partition_threshold_rows;
+
 statement ok
 DROP TABLE fact_table;
 
diff --git a/datafusion/sqllogictest/test_files/projection_pushdown.slt 
b/datafusion/sqllogictest/test_files/projection_pushdown.slt
index 0161bf4118..1735b1fb41 100644
--- a/datafusion/sqllogictest/test_files/projection_pushdown.slt
+++ b/datafusion/sqllogictest/test_files/projection_pushdown.slt
@@ -635,7 +635,10 @@ SELECT id, s['value'] + 1 FROM simple_struct WHERE id > 1 
ORDER BY id LIMIT 2;
 # Section 7: Multi-Partition Tests
 #####################
 
-# Set target_partitions = 4 for parallel execution
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
 statement ok
 SET datafusion.execution.target_partitions = 4;
 
@@ -1990,3 +1993,10 @@ FROM t
 WHERE COALESCE(get_field(s, 'f1'), get_field(s, 'f2')) = 1;
 ----
 1
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+SET datafusion.execution.target_partitions = 4;
diff --git a/datafusion/sqllogictest/test_files/push_down_filter_parquet.slt 
b/datafusion/sqllogictest/test_files/push_down_filter_parquet.slt
index e1c83c8c33..cca6384360 100644
--- a/datafusion/sqllogictest/test_files/push_down_filter_parquet.slt
+++ b/datafusion/sqllogictest/test_files/push_down_filter_parquet.slt
@@ -184,5 +184,12 @@ drop table small_table;
 statement ok
 drop table large_table;
 
+# Config reset
+statement ok
+RESET datafusion.explain.physical_plan_only;
+
+statement ok
+RESET datafusion.execution.parquet.pushdown_filters;
+
 statement ok
 drop table t;
diff --git a/datafusion/sqllogictest/test_files/push_down_filter_regression.slt 
b/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
index dd652d6721..ea75ac32b3 100644
--- a/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
+++ b/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
@@ -185,6 +185,28 @@ physical_plan
 04)------AggregateExec: mode=Partial, gby=[(NULL as id), (id@0 as id)], 
aggr=[max(agg_dyn_test.id)]
 05)--------DataSourceExec: file_groups={2 groups: 
[[WORKSPACE_ROOT/datafusion/core/tests/data/test_statistics_per_partition/date=2025-03-01/j5fUeSDQo22oPyPU.parquet,
 
WORKSPACE_ROOT/datafusion/core/tests/data/test_statistics_per_partition/date=2025-03-02/j5fUeSDQo22oPyPU.parquet],
 
[WORKSPACE_ROOT/datafusion/core/tests/data/test_statistics_per_partition/date=2025-03-03/j5fUeSDQo22oPyPU.parquet,
 
WORKSPACE_ROOT/datafusion/core/tests/data/test_statistics_per_partition/date=2025-03-04/j5fUeSDQ
 [...]
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.explain.format;
+
+statement ok
+reset datafusion.explain.physical_plan_only;
+
+statement ok
+reset datafusion.execution.parquet.pushdown_filters;
+
+statement ok
+reset datafusion.optimizer.enable_dynamic_filter_pushdown;
+
+statement ok
+reset datafusion.optimizer.enable_aggregate_dynamic_filter_pushdown;
+
 statement ok
 drop table agg_dyn_test;
 
diff --git a/datafusion/sqllogictest/test_files/push_down_filter_unnest.slt 
b/datafusion/sqllogictest/test_files/push_down_filter_unnest.slt
index 58fe24e2e2..704ad326cc 100644
--- a/datafusion/sqllogictest/test_files/push_down_filter_unnest.slt
+++ b/datafusion/sqllogictest/test_files/push_down_filter_unnest.slt
@@ -146,3 +146,7 @@ physical_plan
 
 statement ok
 drop table d;
+
+# Config reset
+statement ok
+RESET datafusion.explain.physical_plan_only;
diff --git a/datafusion/sqllogictest/test_files/repartition.slt 
b/datafusion/sqllogictest/test_files/repartition.slt
index 54e445f212..f05458f866 100644
--- a/datafusion/sqllogictest/test_files/repartition.slt
+++ b/datafusion/sqllogictest/test_files/repartition.slt
@@ -138,6 +138,16 @@ FROM t1 WHERE ((false > (v1 = v1)) IS DISTINCT FROM true);
 ----
 1
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.enable_round_robin_repartition;
+
 statement ok
 DROP TABLE t1;
 
diff --git a/datafusion/sqllogictest/test_files/repartition_scan.slt 
b/datafusion/sqllogictest/test_files/repartition_scan.slt
index c9c2f91257..88eaf7118f 100644
--- a/datafusion/sqllogictest/test_files/repartition_scan.slt
+++ b/datafusion/sqllogictest/test_files/repartition_scan.slt
@@ -286,5 +286,12 @@ logical_plan TableScan: avro_table projection=[f1, f2, f3]
 physical_plan DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/testing/data/avro/simple_enum.avro]]}, projection=[f1, f2, 
f3], file_type=avro
 
 # Cleanup
+# Config reset
+statement ok
+RESET datafusion.catalog.create_default_catalog_and_schema;
+
+statement ok
+RESET datafusion.optimizer.repartition_file_min_size;
+
 statement ok
 DROP TABLE avro_table;
diff --git 
a/datafusion/sqllogictest/test_files/repartition_subset_satisfaction.slt 
b/datafusion/sqllogictest/test_files/repartition_subset_satisfaction.slt
index e2c9fa4237..ac2463237b 100644
--- a/datafusion/sqllogictest/test_files/repartition_subset_satisfaction.slt
+++ b/datafusion/sqllogictest/test_files/repartition_subset_satisfaction.slt
@@ -519,6 +519,22 @@ prod 2023-01-01T09:12:30 197.7
 # CLEANUP
 ##########
 
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.enable_round_robin_repartition;
+
+statement ok
+reset datafusion.optimizer.preserve_file_partitions;
+
+statement ok
+reset datafusion.optimizer.subset_repartition_threshold;
+
 statement ok
 DROP TABLE fact_table_ordered;
 
diff --git a/datafusion/sqllogictest/test_files/select.slt 
b/datafusion/sqllogictest/test_files/select.slt
index 553ccb74de..f37ec2233d 100644
--- a/datafusion/sqllogictest/test_files/select.slt
+++ b/datafusion/sqllogictest/test_files/select.slt
@@ -1960,3 +1960,13 @@ query I
 SELECT COUNT(*) FROM t0 AS tt0 WHERE (4==(3/0));
 ----
 0
+
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.max_passes;
diff --git a/datafusion/sqllogictest/test_files/set_variable.slt 
b/datafusion/sqllogictest/test_files/set_variable.slt
index 375d349251..2ba3a73d85 100644
--- a/datafusion/sqllogictest/test_files/set_variable.slt
+++ b/datafusion/sqllogictest/test_files/set_variable.slt
@@ -480,3 +480,13 @@ SET datafusion.runtime.list_files_cache_ttl = 
'1m18446744073709551555s'
 
 statement error DataFusion error: Error during planning: Duration has 
overflowed allowed maximum limit due to 'mins \* 60 \+ secs' when setting 
'datafusion\.runtime\.list_files_cache_ttl'
 SET datafusion.runtime.list_files_cache_ttl = '1m18446744073709551556s'
+
+# Config reset
+statement ok
+RESET datafusion.catalog.create_default_catalog_and_schema
+
+statement ok
+RESET datafusion.catalog.information_schema
+
+statement ok
+RESET datafusion.execution.coalesce_batches
diff --git a/datafusion/sqllogictest/test_files/sort_merge_join.slt 
b/datafusion/sqllogictest/test_files/sort_merge_join.slt
index d2fa37ef76..15f867d900 100644
--- a/datafusion/sqllogictest/test_files/sort_merge_join.slt
+++ b/datafusion/sqllogictest/test_files/sort_merge_join.slt
@@ -940,3 +940,7 @@ FROM t2
 WHERE t2.a > 3 OR t2.a IN (SELECT t3.x FROM t3 WHERE t2.b < 150)
 ----
 4 101 1001
+
+# Config reset
+statement ok
+RESET datafusion.optimizer.prefer_hash_join;
diff --git a/datafusion/sqllogictest/test_files/sort_pushdown.slt 
b/datafusion/sqllogictest/test_files/sort_pushdown.slt
index 99f26b66d4..5f0a93a5fa 100644
--- a/datafusion/sqllogictest/test_files/sort_pushdown.slt
+++ b/datafusion/sqllogictest/test_files/sort_pushdown.slt
@@ -1520,9 +1520,12 @@ SELECT * FROM multi_partition_parquet ORDER BY id ASC;
 8 800
 9 900
 
-# Restore target_partitions to 1 for remaining cleanup
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
 statement ok
-SET datafusion.execution.target_partitions = 2;
+SET datafusion.execution.target_partitions = 4;
 
 # Cleanup
 statement ok
@@ -1631,4 +1634,13 @@ statement ok
 DROP TABLE agg_expr_parquet;
 
 statement ok
-SET datafusion.optimizer.enable_sort_pushdown = true;
+RESET datafusion.execution.parquet.pushdown_filters;
+
+statement ok
+RESET datafusion.execution.parquet.max_row_group_size;
+
+statement ok
+RESET datafusion.execution.parquet.enable_page_index;
+
+statement ok
+RESET datafusion.optimizer.enable_sort_pushdown;
diff --git a/datafusion/sqllogictest/test_files/string/string_view.slt 
b/datafusion/sqllogictest/test_files/string/string_view.slt
index 4639103f9e..5c7236f576 100644
--- a/datafusion/sqllogictest/test_files/string/string_view.slt
+++ b/datafusion/sqllogictest/test_files/string/string_view.slt
@@ -1192,5 +1192,9 @@ logical_plan
 01)Projection: temp.column2 || temp.column3
 02)--TableScan: temp projection=[column2, column3]
 
+# Config reset
+statement ok
+RESET datafusion.explain.logical_plan_only;
+
 statement ok
 drop table test
diff --git a/datafusion/sqllogictest/test_files/struct.slt 
b/datafusion/sqllogictest/test_files/struct.slt
index 53a1bb4ec6..fcc7805372 100644
--- a/datafusion/sqllogictest/test_files/struct.slt
+++ b/datafusion/sqllogictest/test_files/struct.slt
@@ -1665,5 +1665,9 @@ order by id;
 2 1 300
 3 2 150
 
+# Config reset
+statement ok
+RESET datafusion.sql_parser.dialect;
+
 statement ok
 drop table t_agg_window;
diff --git a/datafusion/sqllogictest/test_files/subquery.slt 
b/datafusion/sqllogictest/test_files/subquery.slt
index 9c7c2ddb5d..e5ca9d674e 100644
--- a/datafusion/sqllogictest/test_files/subquery.slt
+++ b/datafusion/sqllogictest/test_files/subquery.slt
@@ -1659,6 +1659,13 @@ logical_plan
 10)----------SubqueryAlias: p
 11)------------TableScan: project_assignments projection=[project_id]
 
+# Config reset
+statement ok
+RESET datafusion.execution.batch_size;
+
+statement ok
+RESET datafusion.explain.logical_plan_only;
+
 statement count 0
 drop table employees;
 
diff --git a/datafusion/sqllogictest/test_files/tpch/tpch.slt 
b/datafusion/sqllogictest/test_files/tpch/tpch.slt
index c6d630997e..764285784a 100644
--- a/datafusion/sqllogictest/test_files/tpch/tpch.slt
+++ b/datafusion/sqllogictest/test_files/tpch/tpch.slt
@@ -28,3 +28,7 @@ set datafusion.optimizer.prefer_hash_join = false;
 include ./answers/q*.slt.part
 
 include ./drop_tables.slt.part
+
+# Config reset
+statement ok
+reset datafusion.optimizer.prefer_hash_join;
\ No newline at end of file
diff --git a/datafusion/sqllogictest/test_files/union.slt 
b/datafusion/sqllogictest/test_files/union.slt
index d858d0ae3e..0f4b02ae25 100644
--- a/datafusion/sqllogictest/test_files/union.slt
+++ b/datafusion/sqllogictest/test_files/union.slt
@@ -976,3 +976,7 @@ query TITT
               END
 ----
 ns3 4 t3 m
+
+# Config reset
+statement ok
+RESET datafusion.execution.batch_size;
diff --git a/datafusion/sqllogictest/test_files/update.slt 
b/datafusion/sqllogictest/test_files/update.slt
index 1cd2b626e3..e8fdab6ab1 100644
--- a/datafusion/sqllogictest/test_files/update.slt
+++ b/datafusion/sqllogictest/test_files/update.slt
@@ -112,3 +112,7 @@ insert into t2 values (1, 'new_val', 2.0, 100), (2, 
'new_val2', 1.5, 200);
 # TODO fix https://github.com/apache/datafusion/issues/19950
 statement error DataFusion error: This feature is not implemented: UPDATE ... 
FROM is not supported
 update t1 as T set b = t2.b, c = t.a, d = 1 from t2 where t.a = t2.a and t.b > 
'foo' and t2.c > 1.0;
+
+# Config reset
+statement ok
+RESET datafusion.optimizer.max_passes;
diff --git a/datafusion/sqllogictest/test_files/window.slt 
b/datafusion/sqllogictest/test_files/window.slt
index 61faf4dc96..9b57e8eb6e 100644
--- a/datafusion/sqllogictest/test_files/window.slt
+++ b/datafusion/sqllogictest/test_files/window.slt
@@ -6122,6 +6122,30 @@ INNER JOIN issue_20194_t2 t2
 ----
 6774502793 10040029 1
 
+# Config reset
+statement ok
+reset datafusion.execution.batch_size;
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+statement ok
+reset datafusion.optimizer.enable_window_limits;
+
+statement ok
+reset datafusion.optimizer.repartition_windows;
+
+statement ok
+reset datafusion.optimizer.repartition_sorts;
+
+statement ok
+reset datafusion.optimizer.skip_failed_rules;
+
+statement ok
+reset datafusion.optimizer.prefer_existing_sort;
+
 statement ok
 DROP TABLE issue_20194_t1;
 
diff --git a/datafusion/sqllogictest/test_files/window_topk_pushdown.slt 
b/datafusion/sqllogictest/test_files/window_topk_pushdown.slt
index 2c33566736..54e907af5c 100644
--- a/datafusion/sqllogictest/test_files/window_topk_pushdown.slt
+++ b/datafusion/sqllogictest/test_files/window_topk_pushdown.slt
@@ -47,7 +47,10 @@ STORED AS CSV
 LOCATION '../../testing/data/csv/aggregate_test_100_with_dates.csv'
 OPTIONS ('format.has_header' 'true');
 
-# Use multiple partitions to trigger hash repartitioning for the window 
function
+# Config reset
+
+# The SLT runner sets `target_partitions` to 4 instead of using the default, 
so 
+# reset it explicitly.
 statement ok
 SET datafusion.execution.target_partitions = 4;
 
@@ -69,6 +72,9 @@ a 1
 a 2
 a 3
 
+statement ok
+RESET datafusion.optimizer.enable_topk_repartition;
+
 # Enabled: results must match baseline
 statement ok
 SET datafusion.optimizer.enable_topk_repartition = true;
@@ -139,3 +145,6 @@ physical_plan
 06)----------RepartitionExec: partitioning=Hash([depname@0], 4), 
input_partitions=1, maintains_sort_order=true
 07)------------SortExec: TopK(fetch=3), expr=[depname@0 ASC NULLS LAST, 
empno@1 ASC NULLS LAST], preserve_partitioning=[true]
 08)--------------DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100_with_dates.csv]]}, 
projection=[depname, empno], file_type=csv, has_header=true
+
+statement ok
+RESET datafusion.optimizer.enable_topk_repartition;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to