You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "debugmiller (via GitHub)" <gi...@apache.org> on 2025/06/03 21:42:17 UTC

[I] TableCommit is not clone-able [iceberg-rust]

debugmiller opened a new issue, #1407:
URL: https://github.com/apache/iceberg-rust/issues/1407

   ### Is your feature request related to a problem or challenge?
   
   The `Catalog` Trait defines the table update as `async fn update_table(&self, commit: TableCommit) -> Result<Table>`. In order to implement this function I need to access `TableCommit.requirements` and `TableCommit.updates` and apply them to the current table metadata as stored in my underlying catalog service. However the only way I could find to access these is with `take_requirements` and `take_updates` which require a `mut TableCommit` and cannot be used since `update_table` is not passed a mut reference.
   
   The simplest solution I could think of was to make `TableCommit` derive `Clone` so I could make a `mut` copy, however if there is a solution I missed please let me know.
    
   sample usage below
   
   ```rust
   async fn update_table(&self, commit: TableCommit) -> Result<Table> {
     let mut commit = commit.clone();
     
     let current_metadata = get_my_table_metadata()?;
     
     for requirement in commit.take_requirements() {
         requirement.check(Some(&current_metadata))?;
     }
     
     let mut metadata_builder: TableMetadataBuilder = 
         TableMetadataBuilder::new_from_metadata(current_metadata.clone(), Some(get_my_metadata_location()));
     
     for update in commit.take_updates() {
         metadata_builder = update.apply(metadata_builder)?;
     }
     let updated_metadata = metadata_builder.build()?.metadata;
   ```
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Willingness to contribute
   
   None


-- 
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-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] TableCommit is not clone-able [iceberg-rust]

Posted by "dentiny (via GitHub)" <gi...@apache.org>.
dentiny commented on issue #1407:
URL: https://github.com/apache/iceberg-rust/issues/1407#issuecomment-2937337468

   Reference for rest catalog implementation: https://github.com/apache/iceberg-rust/blob/e5d3aabf1a15892e89eca7850e32720d89e65e7c/crates/catalog/rest/src/catalog.rs#L727
   


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] TableCommit is not clone-able [iceberg-rust]

Posted by "dentiny (via GitHub)" <gi...@apache.org>.
dentiny commented on issue #1407:
URL: https://github.com/apache/iceberg-rust/issues/1407#issuecomment-2937334003

   ```rs
   impl Catalog for YourCatalog {
     async fn update_table(&self, mut commit: TableCommit) -> IcebergResult<Table> {
       // do your own stuff
     }
   }
   ```
   works for me


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] TableCommit is not clone-able [iceberg-rust]

Posted by "debugmiller (via GitHub)" <gi...@apache.org>.
debugmiller commented on issue #1407:
URL: https://github.com/apache/iceberg-rust/issues/1407#issuecomment-2937399914

   thank you! I did not know `mut` could be used in this way


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] TableCommit is not clone-able [iceberg-rust]

Posted by "debugmiller (via GitHub)" <gi...@apache.org>.
debugmiller closed issue #1407: TableCommit is not clone-able
URL: https://github.com/apache/iceberg-rust/issues/1407


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org