(&self, cmd: DropCatalogSchema)
| 1078 | } |
| 1079 | |
| 1080 | async fn drop_schema(&self, cmd: DropCatalogSchema) -> Result<DataFrame> { |
| 1081 | let DropCatalogSchema { |
| 1082 | name, |
| 1083 | if_exists: allow_missing, |
| 1084 | cascade, |
| 1085 | schema: _, |
| 1086 | } = cmd; |
| 1087 | let catalog = { |
| 1088 | let state = self.state.read(); |
| 1089 | let catalog_name = match &name { |
| 1090 | SchemaReference::Full { catalog, .. } => catalog.to_string(), |
| 1091 | SchemaReference::Bare { .. } => { |
| 1092 | state.config_options().catalog.default_catalog.to_string() |
| 1093 | } |
| 1094 | }; |
| 1095 | if let Some(catalog) = state.catalog_list().catalog(&catalog_name) { |
| 1096 | catalog |
| 1097 | } else if allow_missing { |
| 1098 | return self.return_empty_dataframe(); |
| 1099 | } else { |
| 1100 | return self.schema_doesnt_exist_err(&name); |
| 1101 | } |
| 1102 | }; |
| 1103 | let dereg = catalog.deregister_schema(name.schema_name(), cascade)?; |
| 1104 | match (dereg, allow_missing) { |
| 1105 | (None, true) => self.return_empty_dataframe(), |
| 1106 | (None, false) => self.schema_doesnt_exist_err(&name), |
| 1107 | (Some(_), _) => self.return_empty_dataframe(), |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | fn schema_doesnt_exist_err(&self, schema_ref: &SchemaReference) -> Result<DataFrame> { |
| 1112 | exec_err!("Schema '{schema_ref}' doesn't exist.") |
no test coverage detected