yuqi1129 commented on code in PR #5634:
URL: https://github.com/apache/gravitino/pull/5634#discussion_r1869351727
##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/fs/FileSystemUtils.java:
##########
@@ -41,12 +41,27 @@ public static Map<String, FileSystemProvider>
getFileSystemProviders(String file
ServiceLoader<FileSystemProvider> allFileSystemProviders =
ServiceLoader.load(FileSystemProvider.class);
+ if (null == fileSystemProviders) {
+ // If the file system providers are not specified, return all file
system providers.
+ Streams.stream(allFileSystemProviders.iterator())
+ .forEach(
+ fileSystemProvider -> {
+ if (resultMap.containsKey(fileSystemProvider.scheme())) {
+ throw new UnsupportedOperationException(
+ String.format(
+ "File system provider: '%s' with scheme '%s' already
exists in the provider list, "
+ + "please make sure the file system provider
scheme is unique.",
+ fileSystemProvider.getClass().getName(),
fileSystemProvider.scheme()));
+ }
+ resultMap.put(fileSystemProvider.scheme(), fileSystemProvider);
+ });
+ return resultMap;
Review Comment:
```
ServiceLoader<FileSystemProvider> allFileSystemProviders =
ServiceLoader.load(FileSystemProvider.class);
```
The code above will load HDFS and Local FS automatically.
##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/fs/FileSystemUtils.java:
##########
@@ -41,12 +41,27 @@ public static Map<String, FileSystemProvider>
getFileSystemProviders(String file
ServiceLoader<FileSystemProvider> allFileSystemProviders =
ServiceLoader.load(FileSystemProvider.class);
+ if (null == fileSystemProviders) {
Review Comment:
This method will be also utilized by Gravitino server, in the server side,
file system providers are required if we want to access cloud storage
--
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]