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

Function setup_context

datafusion-cli/src/catalog.rs:227–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225 use datafusion::prelude::SessionContext;
226
227 fn setup_context() -> (SessionContext, Arc<dyn SchemaProvider>) {
228 let ctx = SessionContext::new();
229 ctx.register_catalog_list(Arc::new(DynamicObjectStoreCatalog::new(
230 ctx.state().catalog_list().clone(),
231 ctx.state_weak_ref(),
232 )));
233
234 let provider = &DynamicObjectStoreCatalog::new(
235 ctx.state().catalog_list().clone(),
236 ctx.state_weak_ref(),
237 ) as &dyn CatalogProviderList;
238 let catalog = provider
239 .catalog(provider.catalog_names().first().unwrap())
240 .unwrap();
241 let schema = catalog
242 .schema(catalog.schema_names().first().unwrap())
243 .unwrap();
244 (ctx, schema)
245 }
246
247 #[tokio::test]
248 async fn query_http_location_test() -> Result<()> {

Callers 4

query_http_location_testFunction · 0.70
query_s3_location_testFunction · 0.70
query_gs_location_testFunction · 0.70

Calls 11

newFunction · 0.85
catalog_listMethod · 0.80
state_weak_refMethod · 0.80
register_catalog_listMethod · 0.45
cloneMethod · 0.45
stateMethod · 0.45
catalogMethod · 0.45
firstMethod · 0.45
catalog_namesMethod · 0.45
schemaMethod · 0.45
schema_namesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…