Skip to content

Commit 30660e0

Browse files
authored
chore(deps): update sqllogictest requirement from 0.23.0 to 0.24.0 (#13902)
1 parent b9cef8c commit 30660e0

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

datafusion/sqllogictest/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object_store = { workspace = true }
5151
postgres-protocol = { version = "0.6.7", optional = true }
5252
postgres-types = { version = "0.2.8", features = ["derive", "with-chrono-0_4"], optional = true }
5353
rust_decimal = { version = "1.36.0", features = ["tokio-pg"] }
54-
sqllogictest = "0.23.0"
54+
sqllogictest = "0.24.0"
5555
sqlparser = { workspace = true }
5656
tempfile = { workspace = true }
5757
thiserror = "2.0.0"

datafusion/sqllogictest/bin/sqllogictests.rs

+20-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use datafusion_sqllogictest::{DataFusion, TestContext};
2121
use futures::stream::StreamExt;
2222
use itertools::Itertools;
2323
use log::info;
24-
use sqllogictest::strict_column_validator;
24+
use sqllogictest::{strict_column_validator, Normalizer};
2525
use std::ffi::OsStr;
2626
use std::fs;
2727
use std::path::{Path, PathBuf};
@@ -40,19 +40,25 @@ pub fn main() -> Result<()> {
4040
.block_on(run_tests())
4141
}
4242

43-
fn value_validator(actual: &[Vec<String>], expected: &[String]) -> bool {
44-
let expected = expected
45-
.iter()
46-
// Trailing whitespace from lines in SLT will typically be removed, but do not fail if it is not
47-
// If particular test wants to cover trailing whitespace on a value,
48-
// it should project additional non-whitespace column on the right.
49-
.map(|s| s.trim_end().to_owned())
50-
.collect::<Vec<_>>();
43+
#[allow(clippy::ptr_arg)]
44+
fn normalizer(s: &String) -> String {
45+
// Trailing whitespace from lines in SLT will typically be removed, but do not fail if it is not
46+
// If particular test wants to cover trailing whitespace on a value,
47+
// it should project additional non-whitespace column on the right.
48+
s.trim_end().to_owned()
49+
}
50+
51+
fn value_validator(
52+
normalizer: Normalizer,
53+
actual: &[Vec<String>],
54+
expected: &[String],
55+
) -> bool {
56+
let expected = expected.iter().map(normalizer).collect::<Vec<_>>();
5157
let actual = actual
5258
.iter()
5359
.map(|strs| strs.iter().join(" "))
5460
// Editors do not preserve trailing whitespace, so expected may or may not lack it included
55-
.map(|s| s.trim_end().to_owned())
61+
.map(|str| normalizer(&str))
5662
.collect::<Vec<_>>();
5763
actual == expected
5864
}
@@ -159,6 +165,7 @@ async fn run_test_file(test_file: TestFile) -> Result<()> {
159165
))
160166
});
161167
runner.with_column_validator(strict_column_validator);
168+
runner.with_normalizer(normalizer);
162169
runner.with_validator(value_validator);
163170
runner
164171
.run_file_async(path)
@@ -178,6 +185,7 @@ async fn run_test_file_with_postgres(test_file: TestFile) -> Result<()> {
178185
let mut runner =
179186
sqllogictest::Runner::new(|| Postgres::connect(relative_path.clone()));
180187
runner.with_column_validator(strict_column_validator);
188+
runner.with_normalizer(normalizer);
181189
runner.with_validator(value_validator);
182190
runner
183191
.run_file_async(path)
@@ -217,6 +225,7 @@ async fn run_complete_file(test_file: TestFile) -> Result<()> {
217225
path,
218226
col_separator,
219227
value_validator,
228+
normalizer,
220229
strict_column_validator,
221230
)
222231
.await
@@ -246,6 +255,7 @@ async fn run_complete_file_with_postgres(test_file: TestFile) -> Result<()> {
246255
path,
247256
col_separator,
248257
value_validator,
258+
normalizer,
249259
strict_column_validator,
250260
)
251261
.await

0 commit comments

Comments
 (0)