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

Method register_listing_table

datafusion/core/src/execution/context/mod.rs:1814–1837  ·  view source on GitHub ↗

Registers a [`ListingTable`] that can assemble multiple files from locations in an [`ObjectStore`] instance into a single table. This method is `async` because it might need to resolve the schema. [`ObjectStore`]: object_store::ObjectStore

(
        &self,
        table_ref: impl Into<TableReference>,
        table_path: impl AsRef<str>,
        options: ListingOptions,
        provided_schema: Option<SchemaRef>,
        sql_definition:

Source from the content-addressed store, hash-verified

1812 ///
1813 /// [`ObjectStore`]: object_store::ObjectStore
1814 pub async fn register_listing_table(
1815 &self,
1816 table_ref: impl Into<TableReference>,
1817 table_path: impl AsRef<str>,
1818 options: ListingOptions,
1819 provided_schema: Option<SchemaRef>,
1820 sql_definition: Option<String>,
1821 ) -> Result<()> {
1822 let table_ref = table_ref.into();
1823 let table_path =
1824 ListingTableUrl::parse(table_path)?.with_table_ref(table_ref.clone());
1825 let resolved_schema = match provided_schema {
1826 Some(s) => s,
1827 None => options.infer_schema(&self.state(), &table_path).await?,
1828 };
1829 let config = ListingTableConfig::new(table_path)
1830 .with_listing_options(options)
1831 .with_schema(resolved_schema);
1832 let table = ListingTable::try_new(config)?
1833 .with_definition(sql_definition)
1834 .with_cache(self.runtime_env().cache_manager.get_file_statistic_cache());
1835 self.register_table(table_ref, Arc::new(table))?;
1836 Ok(())
1837 }
1838
1839 fn register_type_check<P: DataFilePaths>(
1840 &self,

Callers 15

query_parquetFunction · 0.80
run_instrumented_queryFunction · 0.80
parquet_exec_visitorFunction · 0.80
read_encryptedFunction · 0.80
dataframe_to_s3Function · 0.80
setup_contextFunction · 0.80
write_table_resultsFunction · 0.80
register_arrowMethod · 0.80

Calls 13

newFunction · 0.85
with_table_refMethod · 0.80
with_listing_optionsMethod · 0.80
with_cacheMethod · 0.80
intoMethod · 0.45
cloneMethod · 0.45
infer_schemaMethod · 0.45
stateMethod · 0.45
with_schemaMethod · 0.45
with_definitionMethod · 0.45
runtime_envMethod · 0.45