Skip to content

Commit 3da3240

Browse files
committed
test: assert exact result rows in leading-tied multi-column RG pruning test
The previous check `formatted.contains("| {b} ")` could be satisfied by the leading `a = 1` column (present in every row), so it did not actually validate the secondary key values. Assert the exact five result rows (full two-column text, in ascending secondary order) instead, so the test validates the secondary key values and their ordering specifically. Addresses kosiew's review on #23888.
1 parent 1187306 commit 3da3240

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

‎datafusion/core/tests/parquet/dynamic_row_group_pruning.rs‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,28 @@ async fn dynamic_rg_pruning_fires_for_multi_column_sort_leading_tied() {
552552
.await;
553553

554554
assert_eq!(output.result_rows, 5, "query must return LIMIT rows");
555+
// The leading key `a = 1` is tied everywhere, so correctness rests
556+
// entirely on the secondary key: the five smallest `b` values must come
557+
// back, in ascending secondary order. Assert the exact result rows
558+
// (full two-column text, in order) rather than just probing for each
559+
// `b` — a bare `| {b} ` match would be satisfied by the leading `a = 1`
560+
// column even if that `b` were missing or misordered.
555561
let formatted = output.pretty_results();
556-
for b in [0i64, 1, 2, 3, 4] {
557-
assert!(
558-
formatted.contains(&format!("| {b} ")),
559-
"output must contain b={b}; got:\n{formatted}",
560-
);
561-
}
562+
let data_rows: Vec<&str> = formatted
563+
.lines()
564+
.filter(|line| line.starts_with("| 1 |"))
565+
.collect();
566+
assert_eq!(
567+
data_rows,
568+
vec![
569+
"| 1 | 0 |",
570+
"| 1 | 1 |",
571+
"| 1 | 2 |",
572+
"| 1 | 3 |",
573+
"| 1 | 4 |",
574+
],
575+
"output must be exactly (a=1, b=0..=4) in ascending secondary order; got:\n{formatted}",
576+
);
562577

563578
let pruned = output
564579
.row_groups_pruned_dynamic_filter()

0 commit comments

Comments
 (0)