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: [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]

Reply via email to