whua3 opened a new pull request, #11814:
URL: https://github.com/apache/gravitino/pull/11814

   FileSystem#getScheme() throws UnsupportedOperationException by default, 
which breaks Hadoop/Spark commit protocols (e.g. FileOutputCommitter, 
ManifestCommitter) when writing to a gvfs:// path. Override getScheme() in 
GravitinoVirtualFileSystem to return the GVFS scheme constant. Added unit test 
testGetScheme in TestGvfsBase.
   
   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): Support xxx"
        - "[#233] fix: Check null before access result in xxx"
        - "[MINOR] refactor: Fix typo in variable name"
        - "[MINOR] docs: Fix typo in README"
        - "[#255] test: Fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   
   Override `getScheme()` in `GravitinoVirtualFileSystem` to return the GVFS 
scheme constant (`gvfs`), instead of relying on the default 
`org.apache.hadoop.fs.FileSystem#getScheme()` which throws 
`UnsupportedOperationException`.
   
   ```java
   @Override
   public String getScheme() {
     return GravitinoVirtualFileSystemConfiguration.GVFS_SCHEME;
   }
   ```
   
   ### Why are the changes needed?
   
   Hadoop's default `FileSystem#getScheme()` throws 
`UnsupportedOperationException` if a subclass doesn't override it. Hadoop / 
Spark commit protocols call `getScheme()` during job setup / commit, so writing 
to a `gvfs://` path currently fails. Returning the well-known `gvfs` scheme — 
which is already the URI scheme GVFS advertises and the value of 
`GravitinoVirtualFileSystemConfiguration.GVFS_SCHEME` — makes GVFS behave like 
every other Hadoop `FileSystem` implementation (LocalFS → `file`, HDFS → 
`hdfs`, S3A → `s3a`, …).
   
   Fix: #11813
   
   ### Does this PR introduce _any_ user-facing change?
   
   No public API change. `FileSystem#getScheme()` on a 
`GravitinoVirtualFileSystem` instance now returns `"gvfs"` instead of throwing. 
No new / removed configuration keys.
   
   ### How was this patch tested?
   
   Added a new unit test `TestGvfsBase#testGetScheme` that asserts 
`fs.getScheme()` equals `GravitinoVirtualFileSystemConfiguration.GVFS_SCHEME`. 
Ran `./gradlew :clients:filesystem-hadoop3:test` locally and all tests pass.
   


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