MCPcopy Create free account
hub / github.com/apache/datafusion / test_object_store_profiling

Function test_object_store_profiling

datafusion-cli/tests/cli_integration.rs:481–538  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

479/// Validate object store profiling output
480#[tokio::test]
481async fn test_object_store_profiling() {
482 if env::var("TEST_STORAGE_INTEGRATION").is_err() {
483 eprintln!("Skipping external storages integration tests");
484 return;
485 }
486
487 let container = match setup_minio_container().await {
488 Ok(c) => c,
489 Err(e) if e.contains("toomanyrequests") => {
490 eprintln!("Skipping test: Docker pull rate limit reached: {e}");
491 return;
492 }
493 e @ Err(_) => e.unwrap(),
494 };
495 let mut settings = make_settings();
496
497 // as the object store profiling contains timestamps and durations, we must
498 // filter them out to have stable snapshots
499 //
500 // Example line to filter:
501 // 2025-10-11T12:02:59.722646+00:00 operation=Get duration=0.001495s size=1006 path=cars.csv
502 // Output:
503 // <TIMESTAMP> operation=Get duration=[DURATION] size=1006 path=cars.csv
504 settings.add_filter(
505 r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?[+-]\d{2}:\d{2} operation=(Get|Put|Delete|List|Head) duration=\d+\.\d{6}s (size=\d+\s+)?path=(.*)",
506 "<TIMESTAMP> operation=$1 duration=[DURATION] ${2}path=$3",
507 );
508
509 // We also need to filter out the summary statistics (anything with an 's' at the end)
510 // Example line(s) to filter:
511 // | Get | duration | 5.000000s | 5.000000s | 5.000000s | | 1 |
512 settings.add_filter(
513 r"\| (Get|Put|Delete|List|Head)( +)\| duration \| .*? \| .*? \| .*? \| .*? \| (.*?) \|",
514 "| $1$2 | duration | ...NORMALIZED...| $3 |",
515 );
516
517 let _bound = settings.bind_to_scope();
518
519 let input = r#"
520 CREATE EXTERNAL TABLE CARS
521STORED AS CSV
522LOCATION 's3://data/cars.csv';
523
524-- Initial query should not show any profiling as the object store is not instrumented yet
525SELECT * from CARS LIMIT 1;
526\object_store_profiling trace
527-- Query again to see the full profiling output
528SELECT * from CARS LIMIT 1;
529\object_store_profiling summary
530-- Query again to see the summarized profiling output
531SELECT * from CARS LIMIT 1;
532\object_store_profiling disabled
533-- Final query should not show any profiling as we disabled it again
534SELECT * from CARS LIMIT 1;
535"#;
536
537 assert_cmd_snapshot!(cli().with_minio(&container).await.pass_stdin(input));
538}

Callers

nothing calls this directly

Calls 4

setup_minio_containerFunction · 0.85
is_errMethod · 0.80
make_settingsFunction · 0.70
containsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…