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

Method create_catalog

datafusion/core/src/execution/context/mod.rs:1030–1050  ·  view source on GitHub ↗
(&self, cmd: CreateCatalog)

Source from the content-addressed store, hash-verified

1028 }
1029
1030 async fn create_catalog(&self, cmd: CreateCatalog) -> Result<DataFrame> {
1031 let CreateCatalog {
1032 catalog_name,
1033 if_not_exists,
1034 ..
1035 } = cmd;
1036 let catalog = self.catalog(catalog_name.as_str());
1037
1038 match (if_not_exists, catalog) {
1039 (true, Some(_)) => self.return_empty_dataframe(),
1040 (true, None) | (false, None) => {
1041 let new_catalog = Arc::new(MemoryCatalogProvider::new());
1042 self.state
1043 .write()
1044 .catalog_list()
1045 .register_catalog(catalog_name, new_catalog);
1046 self.return_empty_dataframe()
1047 }
1048 (false, Some(_)) => exec_err!("Catalog '{catalog_name}' already exists"),
1049 }
1050 }
1051
1052 async fn drop_table(&self, cmd: DropTable) -> Result<DataFrame> {
1053 let DropTable {

Callers 1

execute_logical_planMethod · 0.80

Calls 7

newFunction · 0.85
catalog_listMethod · 0.80
catalogMethod · 0.45
as_strMethod · 0.45
register_catalogMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected