jerryshao commented on code in PR #5020:
URL: https://github.com/apache/gravitino/pull/5020#discussion_r1800393954


##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -742,4 +742,44 @@ private boolean checkSingleFile(Fileset fileset) {
           fileset.name());
     }
   }
+
+  FileSystem getFileSystem(Path path, Map<String, String> config) throws 
IOException {
+    String defaultFilesystemProvider =
+        (String)
+            propertiesMetadata
+                .catalogPropertiesMetadata()
+                .getOrDefault(config, 
HadoopCatalogPropertiesMetadata.DEFAULT_FS);
+
+    Map<String, String> newConfig = Maps.newHashMap(config);
+    if (path == null) {
+      if (defaultFilesystemProvider != null) {
+        return getFileSystemByScheme(defaultFilesystemProvider, newConfig);
+      } else {
+        LOG.warn("The path and default filesystem provider are both null, 
using local file system");
+        return getFileSystemByScheme(LOCAL_FILE_SCHEMA, newConfig);
+      }
+    }
+
+    // Path is not null;
+    if (path.toUri().getScheme() == null) {
+      LOG.warn(
+          "Can't get schema from path: {} and default filesystem provider are 
both null, using"
+              + " local file system",
+          path);
+      return getFileSystemByScheme(LOCAL_FILE_SCHEMA, newConfig);
+    } else {
+      newConfig.put(DEFAULT_FS, path.toUri().toString());

Review Comment:
   What's the purpose of doing this?



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