sfc-gh-sozer opened a new issue, #12277:
URL: https://github.com/apache/iceberg/issues/12277

   ### Apache Iceberg version
   
   1.8.0 (latest release)
   
   ### Query engine
   
   Spark
   
   ### Please describe the bug 🐞
   
   I appreciate the new rewriteTablePath method to support migrating metadata, 
but I have problems with using local "file://..." references.
   
   My metadata currently references  files using elements like  
`"location":"file://iceberg_catalog/metrics.db/data_points","table-uuid":..."` 
to represent a relative path from a project root.
   
   Attempting
   
   ```
           String oldPrefix = "file://iceberg_catalog/metrics.db/";
           String newPrefix = "s3://<bucket_path>";
   
           Table table =  
TABLES.load("iceberg_catalog/metrics.db/data_points/metadata/00003-fb8660aa-1565-4241-b648-10cbf53a8208.metadata.json");
   
           actions()
               .rewriteTablePath(table)
               .rewriteLocationPrefix(oldPrefix, newPrefix)
               .execute();
   ```
   The Table reference is successful but the metadata rewrite fails.   I get 
error logged below:
   ```
   {"ts":"2025-02-14T22:43:44.603Z","level":"INFO","msg":"Table location 
loaded: file://iceberg_catalog/metrics.db/data_points","logger":"HadoopTables"}
   
   Exception in thread "main" java.lang.IllegalArgumentException: Path 
iceberg_catalog/metrics.db/data_points/metadata/00003-fb8660aa-1565-4241-b648-10cbf53a8208.metadata.json
 does not start with file://iceberg_catalog/metrics.db/
           at 
org.apache.iceberg.RewriteTablePathUtil.relativize(RewriteTablePathUtil.java:582)
           at 
org.apache.iceberg.RewriteTablePathUtil.newPath(RewriteTablePathUtil.java:559)
   
   ```
   I suspect the problem is with the use of relative path or nonstandard 
`file://` rather than `file:///` but since this permeates the metadata I'm 
stuck.   ( If I change the TABLES.load argument to begin `file://iceberg...` I 
get an error `expecting file:///..` )   
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [x] I cannot contribute a fix for this bug at this time


-- 
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.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

Reply via email to