-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#6462] fix(filesystem-hadoop3): Fix GVFS client can't find `HDFSFile…
…SystemProvider` problem (#6473) ### What changes were proposed in this pull request? In the current code base, we need to add `catalog-hadoop` to make GVFS client works or class `HDFSFileSystemProvider` and `LocalFileSystemProvider` can't be found. ### Why are the changes needed? It's a bug. Fix: #6462 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? ITs, UTs and test locally. Co-authored-by: Qi Yu <[email protected]>
- Loading branch information
1 parent
44d0518
commit 51b4ba2
Showing
10 changed files
with
138 additions
and
136 deletions.
There are no files selected for viewing
26 changes: 0 additions & 26 deletions
26
catalogs/catalog-common/src/main/java/org/apache/gravitino/catalog/hadoop/Constants.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
...g-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/fs/HDFSFileSystemProvider.java
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
...-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/fs/LocalFileSystemProvider.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
catalogs/hadoop-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.gravitino.catalog.hadoop.fs; | ||
|
||
public class Constants { | ||
|
||
// Name of the built-in local file system provider | ||
public static final String BUILTIN_LOCAL_FS_PROVIDER = "builtin-local"; | ||
|
||
// Name of the built-in HDFS file system provider | ||
public static final String BUILTIN_HDFS_FS_PROVIDER = "builtin-hdfs"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...p-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/HDFSFileSystemProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.gravitino.catalog.hadoop.fs; | ||
|
||
import static org.apache.gravitino.catalog.hadoop.fs.Constants.BUILTIN_HDFS_FS_PROVIDER; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.FileSystem; | ||
import org.apache.hadoop.fs.Path; | ||
|
||
public class HDFSFileSystemProvider implements FileSystemProvider { | ||
|
||
@Override | ||
public FileSystem getFileSystem(@Nonnull Path path, @Nonnull Map<String, String> config) | ||
throws IOException { | ||
Configuration configuration = new Configuration(); | ||
config.forEach( | ||
(k, v) -> { | ||
configuration.set(k.replace(GRAVITINO_BYPASS, ""), v); | ||
}); | ||
return FileSystem.newInstance(path.toUri(), configuration); | ||
} | ||
|
||
@Override | ||
public String scheme() { | ||
return "hdfs"; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return BUILTIN_HDFS_FS_PROVIDER; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/LocalFileSystemProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.gravitino.catalog.hadoop.fs; | ||
|
||
import static org.apache.gravitino.catalog.hadoop.fs.Constants.BUILTIN_HDFS_FS_PROVIDER; | ||
import static org.apache.gravitino.catalog.hadoop.fs.Constants.BUILTIN_LOCAL_FS_PROVIDER; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.FileSystem; | ||
import org.apache.hadoop.fs.Path; | ||
|
||
public class LocalFileSystemProvider implements FileSystemProvider { | ||
|
||
@Override | ||
public FileSystem getFileSystem(Path path, Map<String, String> config) throws IOException { | ||
Configuration configuration = new Configuration(); | ||
config.forEach( | ||
(k, v) -> { | ||
configuration.set(k.replace(BUILTIN_HDFS_FS_PROVIDER, ""), v); | ||
}); | ||
|
||
return FileSystem.newInstance(path.toUri(), configuration); | ||
} | ||
|
||
@Override | ||
public String scheme() { | ||
return "file"; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return BUILTIN_LOCAL_FS_PROVIDER; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters