karim-ramadan opened a new issue, #7287:
URL: https://github.com/apache/iceberg/issues/7287

   ### Apache Iceberg version
   
   main (development)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   ### Problem statement 
   Most of the Hadoop/Spark files API use URIs to address resource locations, 
this solution should work for any OS, but due to some manual URI generation 
inside of unit tests such as:
   
   `String location = table.table().location().replaceFirst("file:", "");
   new File(location + "/data/trashfile").createNewFile();`
   
   and some direct usage of java.io.File instead of URI:
   
   `sql("ALTER TABLE %s ADD PARTITION(id=0) LOCATION '%s'", source, 
temp.newFolder().toString());`
   
   At the current state, unit tests work only on Unix-based operating systems. 
   
   ### Problem solution 
   Replace all manual URI generation with Java API and always use URIs when 
specifying locations.
   Here is the solution to the 2 examples: 
   
   `String location = table.table().location();
   File trashFile = new File(Paths.get(URI.create(location)).toFile(), 
"/data/trashfile");
   trashFile.createNewFile();
   URI trashUri = trashFile.toURI();`
   
   `sql("ALTER TABLE %s ADD PARTITION(id=0) LOCATION '%s'", source, 
temp.newFolder().toURI().toString());`


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