alamb commented on code in PR #21108:
URL: https://github.com/apache/datafusion/pull/21108#discussion_r2976712123
##########
datafusion/sqllogictest/bin/sqllogictests.rs:
##########
@@ -512,26 +525,35 @@ 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.
+ 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;
+ take_config_change_result(&config_change_errors)
Review Comment:
Why does this need to be a mutex? Is it because there is no way to get the
errros back from the runner?
Maybe we could add some documentation about what is going on here?
##########
datafusion/sqllogictest/bin/sqllogictests.rs:
##########
@@ -76,6 +76,19 @@ struct FileTiming {
elapsed: Duration,
}
+type DataFusionConfigChangeErrors = Arc<Mutex<Vec<String>>>;
+
+fn take_config_change_result(
+ config_change_errors: &DataFusionConfigChangeErrors,
+) -> Result<()> {
+ let errors = std::mem::take(&mut *config_change_errors.lock().unwrap());
Review Comment:
since this just copies the strings anyways, it seems like the take is
somewhat unecessary. Maybe you could just get a lock rather than trying to take
it?
--
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]