alamb commented on code in PR #16324:
URL: https://github.com/apache/datafusion/pull/16324#discussion_r2145201108
##########
datafusion/core/tests/sql/explain_analyze.rs:
##########
@@ -52,43 +54,45 @@ async fn explain_analyze_baseline_metrics() {
let formatted = arrow::util::pretty::pretty_format_batches(&results)
.unwrap()
.to_string();
+
println!("Query Output:\n\n{formatted}");
- assert_metrics!(
- &formatted,
- "AggregateExec: mode=Partial, gby=[]",
- "metrics=[output_rows=3, elapsed_compute="
- );
- assert_metrics!(
- &formatted,
- "AggregateExec: mode=FinalPartitioned, gby=[c1@0 as c1]",
- "metrics=[output_rows=5, elapsed_compute="
- );
- assert_metrics!(
- &formatted,
- "FilterExec: c13@1 != C2GT5KVyOPZpgKVl110TyZO0NcJ434",
- "metrics=[output_rows=99, elapsed_compute="
- );
- assert_metrics!(
- &formatted,
- "ProjectionExec: expr=[]",
- "metrics=[output_rows=5, elapsed_compute="
- );
- assert_metrics!(
- &formatted,
- "CoalesceBatchesExec: target_batch_size=4096",
- "metrics=[output_rows=5, elapsed_compute"
- );
- assert_metrics!(
- &formatted,
- "UnionExec",
- "metrics=[output_rows=3, elapsed_compute="
- );
- assert_metrics!(
- &formatted,
- "WindowAggExec",
- "metrics=[output_rows=1, elapsed_compute="
- );
+ let re = Regex::new(r"\|[^|]*\|([^|]*)\|").unwrap();
+ let actual = formatted
+ .lines()
+ .map(|line| re.replace_all(line, "$1").trim_end().to_string())
+ .filter(|line| !line.is_empty() && !line.starts_with('+'))
+ .collect::<Vec<_>>()
+ .join("\n");
Review Comment:
maybe we can just keep using `assert_metrics` for this style test (or
perhaps revert the changes from this PR and work on migrating the metrics tests
to a nicer style in a separate PR so we don't delay merging the other parts of
this PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]