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

Function query_http_csv

datafusion-examples/examples/data_io/query_http_csv.rs:27–56  ·  view source on GitHub ↗

Configure `object_store` and run a query against files via HTTP

()

Source from the content-addressed store, hash-verified

25
26/// Configure `object_store` and run a query against files via HTTP
27pub async fn query_http_csv() -> Result<()> {
28 // create local execution context
29 let ctx = SessionContext::new();
30
31 // setup http object store
32 let base_url = Url::parse("https://github.com").unwrap();
33 let http_store = HttpBuilder::new()
34 .with_url(base_url.clone())
35 .build()
36 .unwrap();
37 ctx.register_object_store(&base_url, Arc::new(http_store));
38
39 // register csv file with the execution context
40 ctx.register_csv(
41 "aggregate_test_100",
42 "https://github.com/apache/arrow-testing/raw/master/data/csv/aggregate_test_100.csv",
43 CsvReadOptions::new(),
44 )
45 .await?;
46
47 // execute the query
48 let df = ctx
49 .sql("SELECT c1,c2,c3 FROM aggregate_test_100 LIMIT 5")
50 .await?;
51
52 // print the results
53 df.show().await?;
54
55 Ok(())
56}

Callers 1

runMethod · 0.85

Calls 7

newFunction · 0.85
sqlMethod · 0.80
showMethod · 0.80
buildMethod · 0.45
cloneMethod · 0.45
register_object_storeMethod · 0.45
register_csvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…