Registers a temporary in-memory table or view. The `name` parameter accepts flexible table references, similar to DataFusion: - `"my_table"` — uses the current catalog and current database - `"database.my_table"` — uses the current catalog with the specified database - `"catalog.database.my_table"` — fully qualified The table exists only for the lifetime of this SQLContext instance.
(
&self,
name: impl Into<TableReference>,
table: Arc<dyn TableProvider>,
)
| 195 | /// |
| 196 | /// The table exists only for the lifetime of this SQLContext instance. |
| 197 | pub fn register_temp_table( |
| 198 | &self, |
| 199 | name: impl Into<TableReference>, |
| 200 | table: Arc<dyn TableProvider>, |
| 201 | ) -> DFResult<()> { |
| 202 | let (catalog, database, table_name) = self.resolve_temp_table_name(name.into())?; |
| 203 | let catalog_provider = self |
| 204 | .ctx |
| 205 | .catalog(&catalog) |
| 206 | .ok_or_else(|| DataFusionError::Plan(format!("Unknown catalog '{catalog}'")))?; |
| 207 | |
| 208 | let paimon_provider = catalog_provider |
| 209 | .as_any() |
| 210 | .downcast_ref::<crate::catalog::PaimonCatalogProvider>() |
| 211 | .ok_or_else(|| { |
| 212 | DataFusionError::Plan(format!("Catalog '{catalog}' is not a Paimon catalog")) |
| 213 | })?; |
| 214 | |
| 215 | paimon_provider.register_temp_table(&database, &table_name, table) |
| 216 | } |
| 217 | |
| 218 | /// Deregisters a temporary table or view. |
| 219 | /// |
no test coverage detected