yuqi1129 commented on code in PR #5020:
URL: https://github.com/apache/gravitino/pull/5020#discussion_r1798810027
##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -742,4 +769,51 @@ private boolean checkSingleFile(Fileset fileset) {
fileset.name());
}
}
+
+ static FileSystem getFileSystem(Path path, Map<String, String> config)
throws IOException {
+ Map<String, String> newConfig = Maps.newHashMap(config);
+ String scheme;
+ Path fsPath;
+ if (path != null) {
+ scheme = path.toUri().getScheme();
+ if (scheme == null) {
+ // If the schema of the path is not set, we need to get the default FS
from the
+ // configuration.
+ String defaultFS = config.get(DEFAULT_FS);
+ if (defaultFS == null) {
+ scheme = LOCAL_FILE_SCHEMA;
+ } else {
+ String schemaFromDefaultFS = new Path(defaultFS).toUri().getScheme();
+ scheme = schemaFromDefaultFS == null ? LOCAL_FILE_SCHEMA :
schemaFromDefaultFS;
Review Comment:
There are two possible outcomes:
1. The user has not set `fs.defaultFS` and the path does not start with a
valid `schema` like `/tmp/fs`, I believe in this case, the schema should be set
to local file.
2. The user already set `fs.defaultFS`, but the value is an invalid `schema`
or null, in this case, as you have said, we need to throw an exception
explicitly.
--
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]