Returns whether a temporary table or view with the given name already exists. Accepts the same flexible name format as `register_temp_table`.
(&self, name: impl Into<TableReference>)
| 242 | /// |
| 243 | /// Accepts the same flexible name format as `register_temp_table`. |
| 244 | pub fn temp_table_exist(&self, name: impl Into<TableReference>) -> DFResult<bool> { |
| 245 | let (catalog, database, table_name) = self.resolve_temp_table_name(name.into())?; |
| 246 | let catalog_provider = self |
| 247 | .ctx |
| 248 | .catalog(&catalog) |
| 249 | .ok_or_else(|| DataFusionError::Plan(format!("Unknown catalog '{catalog}'")))?; |
| 250 | |
| 251 | let paimon_provider = catalog_provider |
| 252 | .as_any() |
| 253 | .downcast_ref::<crate::catalog::PaimonCatalogProvider>() |
| 254 | .ok_or_else(|| { |
| 255 | DataFusionError::Plan(format!("Catalog '{catalog}' is not a Paimon catalog")) |
| 256 | })?; |
| 257 | |
| 258 | Ok(paimon_provider.temp_table_exist(&database, &table_name)) |
| 259 | } |
| 260 | |
| 261 | /// Resolve a TableReference into (catalog, database, table_name). |
| 262 | fn resolve_temp_table_name(&self, name: TableReference) -> DFResult<(String, String, String)> { |
no test coverage detected