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

Function test_dynamic_file_query

datafusion/core/src/execution/context/mod.rs:2521–2551  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2519
2520 #[tokio::test]
2521 async fn test_dynamic_file_query() -> Result<()> {
2522 let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
2523 let path = path.join("tests/tpch-csv/customer.csv");
2524 let url = format!("file://{}", path.display());
2525 let cfg = SessionConfig::new();
2526 let session_state = SessionStateBuilder::new()
2527 .with_default_features()
2528 .with_config(cfg)
2529 .build();
2530 let ctx = SessionContext::new_with_state(session_state).enable_url_table();
2531 let result = plan_and_collect(
2532 &ctx,
2533 format!("select c_name from '{}' limit 3;", &url).as_str(),
2534 )
2535 .await?;
2536
2537 let actual = arrow::util::pretty::pretty_format_batches(&result)
2538 .unwrap()
2539 .to_string();
2540 assert_snapshot!(actual, @r"
2541 +--------------------+
2542 | c_name |
2543 +--------------------+
2544 | Customer#000000002 |
2545 | Customer#000000003 |
2546 | Customer#000000004 |
2547 +--------------------+
2548 ");
2549
2550 Ok(())
2551 }
2552
2553 #[tokio::test]
2554 async fn custom_query_planner() -> Result<()> {

Callers

nothing calls this directly

Calls 9

newFunction · 0.85
with_default_featuresMethod · 0.80
enable_url_tableMethod · 0.80
plan_and_collectFunction · 0.50
joinMethod · 0.45
buildMethod · 0.45
with_configMethod · 0.45
as_strMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…