Zouxxyy opened a new pull request, #7098:
URL: https://github.com/apache/paimon/pull/7098

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... 
-->
   
   ### Purpose
   
   `path.toUri()` converts a path into a standardized URI string (e.g., 
`file:/tmp/path/test file` → `file:/tmp/path/test%20file`), with special 
characters encoded (like spaces → %20).
   
   we should avoid use `new Path(p1.toUri().toString())`, see this test
   
   ```java
   String location = "file:/tmp/path/test file";
   String encodedLocation = "file:/tmp/path/test%20file";
   Path p1 = new Path(location);
   assertThat(p1.toString()).isEqualTo(location);
   assertThat(p1.toUri().toString()).isEqualTo(encodedLocation);
   
   // Using p1.toString() to create a new Path is correct
   Path p2 = new Path(p1.toString());
   assertThat(p2.toString()).isEqualTo(location);
   assertThat(p2.toUri().toString()).isEqualTo(encodedLocation);
   
   // Using p1.toUri().toString to create a new Path will encode again
   Path p3 = new Path(p1.toUri().toString());
   assertThat(p3.toString()).isEqualTo(encodedLocation);
   assertThat(p3.toUri().toString()).isEqualTo("file:/tmp/path/test%2520file");
   ```
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


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

Reply via email to