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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org