Apache DataFusion SQL Query Engine
chore(deps): bump sqllogictest from 0.26.4 to 0.27.0 (#14598)
dependabot[bot]0604bbb6e15d
diff --git a/Cargo.lock b/Cargo.lockindex 79de823cf0..3b1efcf6b2 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -5541,9 +5541,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"[[package]]name = "sqllogictest"-version = "0.26.4"+version = "0.27.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3bc65b5525b4674a844eb6e39a5d4ef2385a3a2b96c13ef82bbe73220f24bcad"+checksum = "df0dc0abbe6af4b4d34dc852bd014e07c16a3ae8c308d72ac45e72ef0fecfbac"dependencies = ["async-trait","educe",diff --git a/datafusion/sqllogictest/Cargo.toml b/datafusion/sqllogictest/Cargo.tomlindex 2f5520c435..f5fc6733bf 100644--- a/datafusion/sqllogictest/Cargo.toml+++ b/datafusion/sqllogictest/Cargo.toml@@ -51,7 +51,7 @@ object_store = { workspace = true }postgres-protocol = { version = "0.6.7", optional = true }postgres-types = { version = "0.2.8", features = ["derive", "with-chrono-0_4"], optional = true }rust_decimal = { version = "1.36.0", features = ["tokio-pg"] }-sqllogictest = "0.26.4"+sqllogictest = "0.27.0"sqlparser = { workspace = true }tempfile = { workspace = true }testcontainers = { version = "0.23", features = ["default"], optional = true }diff --git a/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs b/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rsindex e696058484..a3a29eda2e 100644--- a/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs+++ b/datafusion/sqllogictest/src/engines/datafusion_engine/runner.rs@@ -111,6 +111,8 @@ impl sqllogictest::AsyncDB for DataFusion {async fn sleep(dur: Duration) {tokio::time::sleep(dur).await;}++ async fn shutdown(&mut self) {}}async fn run_query(ctx: &SessionContext, sql: impl Into<String>) -> Result<DFOutput> {diff --git a/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs b/datafusion/sqllogictest/src/engines/postgres_engine/mod.rsindex f0e162fe64..68816626bf 100644--- a/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs+++ b/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs@@ -53,8 +53,9 @@ pub enum Error {pub type Result<T, E = Error> = std::result::Result<T, E>;pub struct Postgres {- client: tokio_postgres::Client,- _spawned_task: SpawnedTask<()>,+ // None means the connection has been shutdown+ client: Option<tokio_postgres::Client>,+ spawned_task: Option<SpawnedTask<()>>,/// Relative test file pathrelative_path: PathBuf,pb: ProgressBar,@@ -90,7 +91,7 @@ impl Postgres {let (client, connection) = res?;- let _spawned_task = SpawnedTask::spawn(async move {+ let spawned_task = SpawnedTask::spawn(async move {if let Err(e) = connection.await {log::error!("Postgres connection error: {:?}", e);}@@ -113,13 +114,17 @@ impl Postgres {.await?;Ok(Self {- client,- _spawned_task,+ client: Some(client),+ spawned_task: Some(spawned_task),relative_path,pb,})}+ fn get_client(&mut self) -> &mut tokio_postgres::Client {+ self.client.as_mut().expect("client is shutdown")+ }+/// Special COPY command support. "COPY 'filename'" requires the/// server to read the file which may not be possible (maybe it is/// remote or running in some other docker container).@@ -170,7 +175,7 @@ impl Postgres {debug!("Copying data from file {filename} using sql: {new_sql}");// start the COPY command and get location to write data to- let tx = self.client.transaction().await?;+ let tx = self.get_client().transaction().await?;let sink = tx.copy_in(&new_sql).await?;let mut sink = Box::pin(sink);@@ -257,12 +262,12 @@ impl sqllogictest::AsyncDB for Postgres {}if !is_query_sql {- self.client.execute(sql, &[]).await?;+ self.get_client().execute(sql, &[]).await?;self.pb.inc(1);return Ok(DBOutput::StatementComplete(0));}let start = Instant::now();- let rows = self.client.query(sql, &[]).await?;+ let rows = self.get_client().query(sql, &[]).await?;let duration = start.elapsed();if duration.gt(&Duration::from_millis(500)) {@@ -272,7 +277,7 @@ impl sqllogictest::AsyncDB for Postgres {self.pb.inc(1);let types: Vec<Type> = if rows.is_empty() {- self.client+ self.get_client().prepare(sql).await?.columns()@@ -300,6 +305,15 @@ impl sqllogictest::AsyncDB for Postgres {fn engine_name(&self) -> &str {"postgres"}++ async fn shutdown(&mut self) {+ if let Some(client) = self.client.take() {+ drop(client);+ }+ if let Some(spawned_task) = self.spawned_task.take() {+ spawned_task.join().await.ok();+ }+ }}fn convert_rows(rows: Vec<Row>) -> Vec<Vec<String>> {