laskoviymishka commented on code in PR #3703:
URL: https://github.com/apache/iceberg-rust/pull/3703#discussion_r4816105948
##########
crates/iceberg/src/table.rs:
##########
@@ -301,6 +312,11 @@ impl Table {
self.readonly
}
+ /// Returns the labels the catalog returned with the table, if any.
+ pub fn labels(&self) -> Option<&Labels> {
Review Comment:
Keeping `Option` here works for me, but could the rustdoc say the two states
differ? As I read it, a missing or `null` `labels` gives `None`
([types.rs#L545](https://github.com/apache/iceberg-rust/blob/9ad2eab6b99bdeff2a93279b14a32adb10dbd5e0/crates/catalog/rest/src/types.rs#L545)),
while `"labels": {}` gives `Some` with both fields empty, since `Labels`
fields are `#[serde(default)]`.
```suggestion
///
/// `None` means the response had no `labels` (or `null`); `"labels":
{}` gives `Some`
/// with empty `object_labels` and `fields`.
pub fn labels(&self) -> Option<&Labels> {
```
##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -1601,6 +1607,9 @@ impl SessionCatalog for RestSessionCatalog {
if let Some(kms_client) = self.kms_client.clone() {
table_builder = table_builder.kms_client(kms_client);
}
+ if let Some(labels) = response.labels {
Review Comment:
Could `do_commit` copy the loaded table's labels onto the committed `Table`?
I agree with DerGut and xanderbailey that they should carry over:
`update_table` builds a fresh `Table` with no `.labels(..)`
([catalog.rs#L1685-L1694](https://github.com/apache/iceberg-rust/blob/9ad2eab6b99bdeff2a93279b14a32adb10dbd5e0/crates/catalog/rest/src/catalog.rs#L1685-L1694)),
and `do_commit` already holds the loaded table when it returns that
([transaction/mod.rs#L221-L253](https://github.com/apache/iceberg-rust/blob/9ad2eab6b99bdeff2a93279b14a32adb10dbd5e0/crates/iceberg/src/transaction/mod.rs#L221-L253)).
A test that commits and checks `labels()` would pin it.
--
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]