This is an automated email from the ASF dual-hosted git repository.
jonah pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 30660e02eb chore(deps): update sqllogictest requirement from 0.23.0 to
0.24.0 (#13902)
30660e02eb is described below
commit 30660e02eb2f1e730d7711685bee46fddfb23c5a
Author: xudong.w <[email protected]>
AuthorDate: Thu Dec 26 09:57:21 2024 +0800
chore(deps): update sqllogictest requirement from 0.23.0 to 0.24.0 (#13902)
---
datafusion/sqllogictest/Cargo.toml | 2 +-
datafusion/sqllogictest/bin/sqllogictests.rs | 30 ++++++++++++++++++----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/datafusion/sqllogictest/Cargo.toml
b/datafusion/sqllogictest/Cargo.toml
index f254e0db41..7ceabd8785 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.23.0"
+sqllogictest = "0.24.0"
sqlparser = { workspace = true }
tempfile = { workspace = true }
thiserror = "2.0.0"
diff --git a/datafusion/sqllogictest/bin/sqllogictests.rs
b/datafusion/sqllogictest/bin/sqllogictests.rs
index be3f1cb251..066cc8ee98 100644
--- a/datafusion/sqllogictest/bin/sqllogictests.rs
+++ b/datafusion/sqllogictest/bin/sqllogictests.rs
@@ -21,7 +21,7 @@ use datafusion_sqllogictest::{DataFusion, TestContext};
use futures::stream::StreamExt;
use itertools::Itertools;
use log::info;
-use sqllogictest::strict_column_validator;
+use sqllogictest::{strict_column_validator, Normalizer};
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
@@ -40,19 +40,25 @@ pub fn main() -> Result<()> {
.block_on(run_tests())
}
-fn value_validator(actual: &[Vec<String>], expected: &[String]) -> bool {
- let expected = expected
- .iter()
- // Trailing whitespace from lines in SLT will typically be removed,
but do not fail if it is not
- // If particular test wants to cover trailing whitespace on a value,
- // it should project additional non-whitespace column on the right.
- .map(|s| s.trim_end().to_owned())
- .collect::<Vec<_>>();
+#[allow(clippy::ptr_arg)]
+fn normalizer(s: &String) -> String {
+ // Trailing whitespace from lines in SLT will typically be removed, but do
not fail if it is not
+ // If particular test wants to cover trailing whitespace on a value,
+ // it should project additional non-whitespace column on the right.
+ s.trim_end().to_owned()
+}
+
+fn value_validator(
+ normalizer: Normalizer,
+ actual: &[Vec<String>],
+ expected: &[String],
+) -> bool {
+ let expected = expected.iter().map(normalizer).collect::<Vec<_>>();
let actual = actual
.iter()
.map(|strs| strs.iter().join(" "))
// Editors do not preserve trailing whitespace, so expected may or may
not lack it included
- .map(|s| s.trim_end().to_owned())
+ .map(|str| normalizer(&str))
.collect::<Vec<_>>();
actual == expected
}
@@ -159,6 +165,7 @@ async fn run_test_file(test_file: TestFile) -> Result<()> {
))
});
runner.with_column_validator(strict_column_validator);
+ runner.with_normalizer(normalizer);
runner.with_validator(value_validator);
runner
.run_file_async(path)
@@ -178,6 +185,7 @@ async fn run_test_file_with_postgres(test_file: TestFile)
-> Result<()> {
let mut runner =
sqllogictest::Runner::new(|| Postgres::connect(relative_path.clone()));
runner.with_column_validator(strict_column_validator);
+ runner.with_normalizer(normalizer);
runner.with_validator(value_validator);
runner
.run_file_async(path)
@@ -217,6 +225,7 @@ async fn run_complete_file(test_file: TestFile) ->
Result<()> {
path,
col_separator,
value_validator,
+ normalizer,
strict_column_validator,
)
.await
@@ -246,6 +255,7 @@ async fn run_complete_file_with_postgres(test_file:
TestFile) -> Result<()> {
path,
col_separator,
value_validator,
+ normalizer,
strict_column_validator,
)
.await
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]