This is an automated email from the ASF dual-hosted git repository.
liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new a4054140d fix: MemoryCatalog to return absolute NamespaceIdents (#1970)
a4054140d is described below
commit a4054140d9ea66022a11835afa3a68bc4eb72cec
Author: André Eickler <[email protected]>
AuthorDate: Tue Dec 30 02:32:38 2025 +0100
fix: MemoryCatalog to return absolute NamespaceIdents (#1970)
## Which issue does this PR close?
- Closes #1969.
## What changes are included in this PR?
The change makes `list_namespaces(parent)` return an absolute namespace
identifier instead of a relative.
## Are these changes tested?
The associated unit tests are updated with the same behaviour as
SqlCatalog.
---
crates/iceberg/src/catalog/memory/catalog.rs | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/crates/iceberg/src/catalog/memory/catalog.rs
b/crates/iceberg/src/catalog/memory/catalog.rs
index cfa3dc6b5..df0299acb 100644
--- a/crates/iceberg/src/catalog/memory/catalog.rs
+++ b/crates/iceberg/src/catalog/memory/catalog.rs
@@ -163,8 +163,12 @@ impl Catalog for MemoryCatalog {
let namespaces = root_namespace_state
.list_namespaces_under(parent_namespace_ident)?
.into_iter()
- .map(|name| NamespaceIdent::new(name.to_string()))
- .collect_vec();
+ .map(|name| {
+ let mut names =
parent_namespace_ident.iter().cloned().collect::<Vec<_>>();
+ names.push(name.to_string());
+ NamespaceIdent::from_vec(names)
+ })
+ .collect::<Result<Vec<_>>>()?;
Ok(namespaces)
}
@@ -599,7 +603,7 @@ pub(crate) mod tests {
.list_namespaces(Some(&namespace_ident_1))
.await
.unwrap(),
- vec![NamespaceIdent::new("b".into())]
+ vec![namespace_ident_2]
);
}
@@ -628,9 +632,9 @@ pub(crate) mod tests {
.unwrap()
),
to_set(vec![
- NamespaceIdent::new("a".into()),
- NamespaceIdent::new("b".into()),
- NamespaceIdent::new("c".into()),
+ namespace_ident_2,
+ namespace_ident_3,
+ namespace_ident_4,
])
);
}