Skip to content

Commit 2eb94d4

Browse files
committed
Simplify timing UX and remove complexity
Streamline timing summary to a single switch, enabling full deterministic per-file timings sorted slowest-first. Eliminate all mode and top-N options in sqllogictests.rs, including the removal of TimingSummaryMode and related auto branching for summary output. Update README.md to recommend Unix post-processing with `| head -n 10`.
1 parent 789e64e commit 2eb94d4

2 files changed

Lines changed: 15 additions & 78 deletions

File tree

datafusion/sqllogictest/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,22 @@ RUST_LOG=debug cargo test --test sqllogictests -- ddl
7575
The sqllogictest runner can emit deterministic per-file elapsed timings to help
7676
identify slow test files.
7777

78-
By default (`--timing-summary auto`), timing summary output is disabled in local
79-
TTY runs and shows a top-slowest summary in non-TTY/CI runs.
80-
81-
`--timing-top-n` / `SLT_TIMING_TOP_N` must be a positive integer (`>= 1`).
78+
Timing summary output is disabled by default and enabled with
79+
`--timing-summary` (or `SLT_TIMING_SUMMARY=1`).
8280

8381
```shell
84-
# Show top 10 slowest files (good for CI)
85-
cargo test --test sqllogictests -- --timing-summary top --timing-top-n 10
82+
# Show deterministic per-file elapsed timings (sorted slowest first)
83+
cargo test --test sqllogictests -- --timing-summary
8684
```
8785

8886
```shell
89-
# Show full per-file timing table
90-
cargo test --test sqllogictests -- --timing-summary full
87+
# Keep only the top 10 lines using standard shell tooling
88+
cargo test --test sqllogictests -- --timing-summary | head -n 10
9189
```
9290

9391
```shell
94-
# Same controls via environment variables
95-
SLT_TIMING_SUMMARY=top SLT_TIMING_TOP_N=15 cargo test --test sqllogictests
92+
# Enable via environment variable
93+
SLT_TIMING_SUMMARY=1 cargo test --test sqllogictests
9694
```
9795

9896
```shell

datafusion/sqllogictest/bin/sqllogictests.rs

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use clap::{ColorChoice, Parser, ValueEnum};
18+
use clap::{ColorChoice, Parser};
1919
use datafusion::common::instant::Instant;
2020
use datafusion::common::utils::get_available_parallelism;
2121
use datafusion::common::{DataFusionError, Result, exec_datafusion_err, exec_err};
@@ -61,14 +61,6 @@ const SQLITE_PREFIX: &str = "sqlite";
6161
const ERRS_PER_FILE_LIMIT: usize = 10;
6262
const TIMING_DEBUG_SLOW_FILES_ENV: &str = "SLT_TIMING_DEBUG_SLOW_FILES";
6363

64-
#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
65-
enum TimingSummaryMode {
66-
Auto,
67-
Off,
68-
Top,
69-
Full,
70-
}
71-
7264
#[derive(Debug)]
7365
struct FileTiming {
7466
relative_path: PathBuf,
@@ -321,7 +313,7 @@ async fn run_tests() -> Result<()> {
321313
.then_with(|| a.relative_path.cmp(&b.relative_path))
322314
});
323315

324-
print_timing_summary(&options, &m, is_ci, &file_timings)?;
316+
print_timing_summary(&options, &m, &file_timings)?;
325317

326318
let errors: Vec<_> = file_results
327319
.into_iter()
@@ -384,27 +376,14 @@ async fn run_tests() -> Result<()> {
384376
fn print_timing_summary(
385377
options: &Options,
386378
progress: &MultiProgress,
387-
is_ci: bool,
388379
file_timings: &[FileTiming],
389380
) -> Result<()> {
390-
let mode = options.timing_summary_mode(is_ci);
391-
if mode == TimingSummaryMode::Off || file_timings.is_empty() {
381+
if !options.timing_summary || file_timings.is_empty() {
392382
return Ok(());
393383
}
394384

395-
let top_n = options.timing_top_n;
396-
debug_assert!(matches!(
397-
mode,
398-
TimingSummaryMode::Top | TimingSummaryMode::Full
399-
));
400-
let count = if mode == TimingSummaryMode::Full {
401-
file_timings.len()
402-
} else {
403-
top_n
404-
};
405-
406385
progress.println("Per-file elapsed summary (deterministic):")?;
407-
for (idx, timing) in file_timings.iter().take(count).enumerate() {
386+
for (idx, timing) in file_timings.iter().enumerate() {
408387
progress.println(format!(
409388
"{:>3}. {:>8.3}s {}",
410389
idx + 1,
@@ -413,13 +392,6 @@ fn print_timing_summary(
413392
))?;
414393
}
415394

416-
if mode != TimingSummaryMode::Full && file_timings.len() > count {
417-
progress.println(format!(
418-
"... {} more files omitted (use --timing-summary full to show all)",
419-
file_timings.len() - count
420-
))?;
421-
}
422-
423395
Ok(())
424396
}
425397

@@ -434,16 +406,6 @@ fn is_env_truthy(name: &str) -> bool {
434406
})
435407
}
436408

437-
fn parse_timing_top_n(arg: &str) -> std::result::Result<usize, String> {
438-
let parsed = arg
439-
.parse::<usize>()
440-
.map_err(|error| format!("invalid value '{arg}': {error}"))?;
441-
if parsed == 0 {
442-
return Err("must be >= 1".to_string());
443-
}
444-
Ok(parsed)
445-
}
446-
447409
async fn run_test_file_substrait_round_trip(
448410
test_file: TestFile,
449411
validator: Validator,
@@ -940,20 +902,10 @@ struct Options {
940902
#[clap(
941903
long,
942904
env = "SLT_TIMING_SUMMARY",
943-
value_enum,
944-
default_value_t = TimingSummaryMode::Auto,
945-
help = "Per-file timing summary mode: auto|off|top|full"
946-
)]
947-
timing_summary: TimingSummaryMode,
948-
949-
#[clap(
950-
long,
951-
env = "SLT_TIMING_TOP_N",
952-
default_value_t = 10,
953-
value_parser = parse_timing_top_n,
954-
help = "Number of files to show when timing summary mode is auto/top (must be >= 1)"
905+
default_value_t = false,
906+
help = "Print deterministic per-file timing summary"
955907
)]
956-
timing_top_n: usize,
908+
timing_summary: bool,
957909

958910
#[clap(
959911
long,
@@ -965,19 +917,6 @@ struct Options {
965917
}
966918

967919
impl Options {
968-
fn timing_summary_mode(&self, is_ci: bool) -> TimingSummaryMode {
969-
match self.timing_summary {
970-
TimingSummaryMode::Auto => {
971-
if is_ci {
972-
TimingSummaryMode::Top
973-
} else {
974-
TimingSummaryMode::Off
975-
}
976-
}
977-
mode => mode,
978-
}
979-
}
980-
981920
/// Because this test can be run as a cargo test, commands like
982921
///
983922
/// ```shell

0 commit comments

Comments
 (0)