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

Method get_table

benchmarks/src/bin/external_aggr.rs:305–332  ·  view source on GitHub ↗
(
        &self,
        ctx: &SessionContext,
        table: &str,
    )

Source from the content-addressed store, hash-verified

303 }
304
305 async fn get_table(
306 &self,
307 ctx: &SessionContext,
308 table: &str,
309 ) -> Result<Arc<dyn TableProvider>> {
310 let path = self.path.to_str().unwrap();
311
312 // Obtain a snapshot of the SessionState
313 let state = ctx.state();
314 let path = format!("{path}/{table}");
315 let format = Arc::new(
316 ParquetFormat::default()
317 .with_options(ctx.state().table_options().parquet.clone()),
318 );
319 let extension = DEFAULT_PARQUET_EXTENSION;
320
321 let options = ListingOptions::new(format)
322 .with_file_extension(extension)
323 .with_collect_stat(state.config().collect_statistics());
324
325 let table_path = ListingTableUrl::parse(path)?;
326 let config = ListingTableConfig::new(table_path).with_listing_options(options);
327 let config = config.infer_schema(&state).await?;
328
329 Ok(Arc::new(ListingTable::try_new(config)?.with_cache(
330 ctx.runtime_env().cache_manager.get_file_statistic_cache(),
331 )))
332 }
333
334 fn iterations(&self) -> usize {
335 self.common.iterations

Callers 1

register_tablesMethod · 0.45

Calls 14

newFunction · 0.85
with_collect_statMethod · 0.80
with_file_extensionMethod · 0.80
collect_statisticsMethod · 0.80
with_listing_optionsMethod · 0.80
with_cacheMethod · 0.80
stateMethod · 0.45
with_optionsMethod · 0.45
cloneMethod · 0.45
table_optionsMethod · 0.45
configMethod · 0.45

Tested by

no test coverage detected