Skip to content

Commit f8a440f

Browse files
Fmt
1 parent c41636a commit f8a440f

2 files changed

Lines changed: 39 additions & 11 deletions

File tree

crates/datafusion-app/src/stats.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use std::{collections::HashMap, sync::Arc, time::Duration};
4545
pub struct AnalyzeQueryRequest {
4646
/// SQL query to analyze (currently the only supported format)
4747
pub sql: Option<String>,
48-
4948
// Future extensibility fields (not yet implemented):
5049
// /// Substrait query plan (binary or JSON)
5150
// pub substrait: Option<Vec<u8>>,
@@ -1581,10 +1580,28 @@ impl ExecutionIOStats {
15811580
let get_metric = |namespaced: &str, legacy: &str| -> Option<u64> {
15821581
// Try format-specific namespace
15831582
metrics
1584-
.get(&format!("io.csv.{}", namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced)))
1585-
.or_else(|| metrics.get(&format!("io.parquet.{}", namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced))))
1586-
.or_else(|| metrics.get(&format!("io.arrow.{}", namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced))))
1587-
.or_else(|| metrics.get(&format!("io.json.{}", namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced))))
1583+
.get(&format!(
1584+
"io.csv.{}",
1585+
namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced)
1586+
))
1587+
.or_else(|| {
1588+
metrics.get(&format!(
1589+
"io.parquet.{}",
1590+
namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced)
1591+
))
1592+
})
1593+
.or_else(|| {
1594+
metrics.get(&format!(
1595+
"io.arrow.{}",
1596+
namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced)
1597+
))
1598+
})
1599+
.or_else(|| {
1600+
metrics.get(&format!(
1601+
"io.json.{}",
1602+
namespaced.strip_prefix("io.parquet.").unwrap_or(namespaced)
1603+
))
1604+
})
15881605
.or_else(|| metrics.get(namespaced))
15891606
.or_else(|| metrics.get(legacy))
15901607
.copied()

tests/extension_cases/flightsql.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,9 @@ pub async fn test_analyze_operator_hierarchy() {
19401940
"Should have aggregate operator"
19411941
);
19421942
assert!(
1943-
output.contains("FilterExec") || output.contains("filter") || output.contains("CoalesceBatchesExec"),
1943+
output.contains("FilterExec")
1944+
|| output.contains("filter")
1945+
|| output.contains("CoalesceBatchesExec"),
19441946
"Should have filter or coalesce operator"
19451947
);
19461948

@@ -1971,7 +1973,11 @@ pub async fn test_analyze_operator_hierarchy_with_csv() {
19711973

19721974
// Register the aggregate_test_100.csv file
19731975
ctx.session_ctx()
1974-
.register_csv("test_data", "data/aggregate_test_100.csv", CsvReadOptions::new())
1976+
.register_csv(
1977+
"test_data",
1978+
"data/aggregate_test_100.csv",
1979+
CsvReadOptions::new(),
1980+
)
19751981
.await
19761982
.expect("Failed to register CSV table");
19771983

@@ -2141,7 +2147,9 @@ pub async fn test_analyze_io_metrics_parquet_namespace() {
21412147
"Should NOT use io.json.* namespace for Parquet files"
21422148
);
21432149
} else {
2144-
eprintln!("Note: No I/O metrics reported (expected for small datasets or registered tables)");
2150+
eprintln!(
2151+
"Note: No I/O metrics reported (expected for small datasets or registered tables)"
2152+
);
21452153
}
21462154

21472155
// Verify compute metrics are always present
@@ -2223,7 +2231,9 @@ pub async fn test_analyze_io_metrics_json_namespace() {
22232231
"Should NOT use io.parquet.* namespace for JSON files"
22242232
);
22252233
} else {
2226-
eprintln!("Note: No I/O metrics reported (expected for small datasets or registered tables)");
2234+
eprintln!(
2235+
"Note: No I/O metrics reported (expected for small datasets or registered tables)"
2236+
);
22272237
}
22282238

22292239
// Verify compute metrics are always present
@@ -2310,7 +2320,9 @@ pub async fn test_analyze_io_metrics_arrow_namespace() {
23102320
"Should NOT use io.json.* namespace for Arrow files"
23112321
);
23122322
} else {
2313-
eprintln!("Note: No I/O metrics reported (expected for small datasets or registered tables)");
2323+
eprintln!(
2324+
"Note: No I/O metrics reported (expected for small datasets or registered tables)"
2325+
);
23142326
}
23152327

23162328
// Verify compute metrics are always present
@@ -2321,4 +2333,3 @@ pub async fn test_analyze_io_metrics_arrow_namespace() {
23212333

23222334
fixture.shutdown_and_wait().await;
23232335
}
2324-

0 commit comments

Comments
 (0)