Skip to content

Commit 8231641

Browse files
author
Jan Kaul
committed
add schema exists check
1 parent 926b4ab commit 8231641

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

datafusion_iceberg/src/catalog/catalog.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ impl CatalogProvider for IcebergCatalog {
4343
}
4444
}
4545
fn schema(&self, name: &str) -> Option<Arc<dyn SchemaProvider>> {
46+
if !self.catalog.schema_exists(name) {
47+
return None;
48+
}
4649
Some(Arc::new(IcebergSchema::new(
4750
Namespace::try_new(
4851
&name

datafusion_iceberg/src/catalog/mirror.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ impl Mirror {
184184
self.storage.contains_key(&identifier.to_string())
185185
}
186186

187+
pub fn schema_exists(&self, name: &str) -> bool {
188+
self.storage.get(name).map_or(false, |node| {
189+
matches!(node.value(), Node::Namespace(_))
190+
})
191+
}
192+
187193
pub fn catalog(&self) -> Arc<dyn Catalog> {
188194
self.catalog.clone()
189195
}

0 commit comments

Comments
 (0)