LuciferYang opened a new issue, #9637:
URL: https://github.com/apache/paimon/issues/9637

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   ### Paimon version
   
   master, `475be566f` (2.1-SNAPSHOT).
   
   ### Compute Engine
   
   Any engine reading or writing a table through a REST catalog with 
`data-token.enabled`, plus paimon-vfs.
   
   ### Minimal reproduce step
   
   Make the inner FileIO fail to build, for example a data token whose options 
do not satisfy the loader for that scheme, and call any FileIO method on the 
`RESTTokenFileIO`:
   
   ```java
   fileIO.exists(tableRoot);
   // java.io.UncheckedIOException: 
org.apache.paimon.fs.UnsupportedSchemeException: ...
   ```
   
   `fileIO()` declares the checked exception and then throws an unchecked one:
   
   ```java
   public FileIO fileIO() throws IOException {
       ...
       try {
           fileIO = FileIO.get(path, context);
       } catch (IOException e) {
           throw new UncheckedIOException(e);
       }
   ```
   
   The cache is keyed by the `RESTToken`, so this runs again after every token 
refresh rather than once at startup.
   
   ### What doesn't meet your expectations?
   
   The signature already promises a checked `IOException`, so wrapping it 
defeats callers that handle it. Two of them, outside paimon-common, are written 
for the declared contract and can never run today:
   
   ```java
   // paimon-lance LanceUtils, and the same in paimon-vortex VortexUtils
   try {
       fileIO = ((RESTTokenFileIO) fileIO).fileIO();
   } catch (IOException e) {
       throw new RuntimeException("Can't get fileIO from RESTTokenFileIO", e);
   }
   ```
   
   Instead of that message, a user gets a bare `UncheckedIOException` from 
wherever the call happened to be.
   
   ### Anything else?
   
   I did not search exhaustively for code that catches `UncheckedIOException` 
on purpose; I checked the two call sites of `fileIO()` outside paimon-common.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


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