c-thiel commented on code in PR #641:
URL: https://github.com/apache/iceberg-rust/pull/641#discussion_r1772000307
##########
crates/iceberg/src/catalog/mod.rs:
##########
@@ -133,6 +133,16 @@ impl NamespaceIdent {
pub fn inner(self) -> Vec<String> {
self.0
}
+
+ /// Get the parent of this namespace.
+ /// Returns None if this namespace only has a single element and thus has
no parent.
+ pub fn parent(&self) -> Option<Self> {
+ if self.0.len() <= 1 {
+ None
+ } else {
+ Some(Self(self.0[..self.0.len() - 1].to_vec()))
+ }
+ }
Review Comment:
It's not quite as elegant, as split_last() might still yield an empty
parent. I switched to `split_last` in the latest commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]