This is an automated email from the ASF dual-hosted git repository.

liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 28df4ec4e fix: Interpret s3tables warehouse as table_location not 
metadata loca… (#2115)
28df4ec4e is described below

commit 28df4ec4e308c08faa29e728a62406f690d0128c
Author: emkornfield <[email protected]>
AuthorDate: Wed Feb 11 23:16:17 2026 -0800

    fix: Interpret s3tables warehouse as table_location not metadata loca… 
(#2115)
    
    ## Which issue does this PR close?
    
    AWS
    
[Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-tables.html)
    state:
    
    
    > When you create a table, Amazon S3 automatically generates a warehouse
    location for the table. This is a unique S3 location that stores objects
    associated with the table. The following example shows the format of a
    warehouse location:
    
    ```
    s3://63a8e430-6e0b-46f5-k833abtwr6s8tmtsycedn8s4yc3xhuse1b--table-s3
    ```
    
    We were previously interpreting this as as a metadata location (i.e. the
    path to the metadata.json file), this changes the code use it as a table
    location.
    
    - Closes #2114
    
    ## What changes are included in this PR?
    
    Change how we construct the MetadataLocation object.
    
    ## Are these changes tested?
    
    There never appears to have been a test, and I don't have an AWS account
    to verify this. Note the test was initially developed by Claude Code and
    refined by me.
---
 crates/catalog/s3tables/src/catalog.rs | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/crates/catalog/s3tables/src/catalog.rs 
b/crates/catalog/s3tables/src/catalog.rs
index 3606fac99..a6ac60bc7 100644
--- a/crates/catalog/s3tables/src/catalog.rs
+++ b/crates/catalog/s3tables/src/catalog.rs
@@ -448,9 +448,9 @@ impl Catalog for S3TablesCatalog {
             .await
             .map_err(from_aws_sdk_error)?;
 
-        // prepare metadata location. the warehouse location is generated by 
s3tables catalog,
+        // prepare table location. the warehouse location is generated by 
s3tables catalog,
         // which looks like: 
s3://e6c9bf20-991a-46fb-kni5xs1q2yxi3xxdyxzjzigdeop1quse2b--table-s3
-        let metadata_location = match &creation.location {
+        let table_location = match &creation.location {
             Some(_) => {
                 return Err(Error::new(
                     ErrorKind::DataInvalid,
@@ -467,16 +467,17 @@ impl Catalog for S3TablesCatalog {
                     .send()
                     .await
                     .map_err(from_aws_sdk_error)?;
-                let warehouse_location = 
get_resp.warehouse_location().to_string();
-                
MetadataLocation::new_with_table_location(warehouse_location).to_string()
+                get_resp.warehouse_location().to_string()
             }
         };
 
         // write metadata to file
-        creation.location = Some(metadata_location.clone());
+        creation.location = Some(table_location.clone());
         let metadata = TableMetadataBuilder::from_table_creation(creation)?
             .build()?
             .metadata;
+        let metadata_location =
+            
MetadataLocation::new_with_table_location(table_location).to_string();
         metadata.write_to(&self.file_io, &metadata_location).await?;
 
         // update metadata location

Reply via email to