Configure `object_store` and run a query against files via HTTP
()
| 25 | |
| 26 | /// Configure `object_store` and run a query against files via HTTP |
| 27 | pub 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 | } |
no test coverage detected
searching dependent graphs…