MCPcopy Create free account
hub / github.com/apache/paimon-rust / temp_table_exist

Method temp_table_exist

crates/integrations/datafusion/src/sql_context.rs:244–259  ·  view source on GitHub ↗

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>)

Source from the content-addressed store, hash-verified

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)> {

Callers 3

handle_create_viewMethod · 0.45

Calls 3

PlanClass · 0.50
as_anyMethod · 0.45

Tested by

no test coverage detected