Skip to content

Commit 008999f

Browse files
committed
feat(hadoop_filesystem): support gravitino gvfs
1 parent 4d70341 commit 008999f

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

WORKSPACE

+26-7
Original file line numberDiff line numberDiff line change
@@ -878,23 +878,42 @@ http_archive(
878878
)
879879

880880
# Needed for llvm_toolchain and Golang
881+
# http_archive(
882+
# name = "com_grail_bazel_toolchain",
883+
# sha256 = "9e6065ded4b7453143e1586d6819729a63cd233114b72bf85ff3435367b02c90",
884+
# strip_prefix = "bazel-toolchain-edd07e96a2ecaa131af9234d6582875d980c0ac7",
885+
# urls = [
886+
# "https://storage.googleapis.com/mirror.tensorflow.org/github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
887+
# "https://github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
888+
# ],
889+
# )
890+
891+
# load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
892+
893+
# llvm_toolchain(
894+
# name = "llvm_toolchain",
895+
# llvm_version = "9.0.0",
896+
# )
897+
881898
http_archive(
882899
name = "com_grail_bazel_toolchain",
883-
sha256 = "9e6065ded4b7453143e1586d6819729a63cd233114b72bf85ff3435367b02c90",
884-
strip_prefix = "bazel-toolchain-edd07e96a2ecaa131af9234d6582875d980c0ac7",
885-
urls = [
886-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
887-
"https://github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
888-
],
900+
urls = ["https://github.com/bazel-contrib/toolchains_llvm/archive/refs/tags/0.9.tar.gz"],
901+
sha256 = "b2d168315dd0785f170b2b306b86e577c36e812b8f8b05568f9403141f2c24dd",
902+
strip_prefix = "toolchains_llvm-0.9",
889903
)
890904

891-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
905+
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
906+
907+
bazel_toolchain_dependencies()
892908

909+
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
893910
llvm_toolchain(
894911
name = "llvm_toolchain",
895912
llvm_version = "9.0.0",
896913
)
897914

915+
916+
898917
# Golang related ruls, consider removal after switching to C++/C client for prometheus
899918
http_archive(
900919
name = "io_bazel_rules_go",

tensorflow_io/core/filesystems/filesystem_plugins.cc

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ limitations under the License.
2929
TFIO_PLUGIN_EXPORT void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
3030
info->plugin_memory_allocate = tensorflow::io::plugin_memory_allocate;
3131
info->plugin_memory_free = tensorflow::io::plugin_memory_free;
32-
info->num_schemes = 7;
32+
3333
#if !defined(_MSC_VER)
3434
info->num_schemes = 8;
3535
#endif
36+
3637
info->ops = static_cast<TF_FilesystemPluginOps*>(
3738
tensorflow::io::plugin_memory_allocate(info->num_schemes *
3839
sizeof(info->ops[0])));
@@ -43,7 +44,11 @@ TFIO_PLUGIN_EXPORT void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
4344
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "hdfs");
4445
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "viewfs");
4546
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[6], "har");
47+
<<<<<<< HEAD
4648
#if !defined(_MSC_VER)
4749
tensorflow::io::oss::ProvideFilesystemSupportFor(&info->ops[7], "oss");
4850
#endif
51+
=======
52+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[7], "gvfs");
53+
>>>>>>> feat(gvfs): support gvfs
4954
}

tensorflow_io/core/filesystems/hdfs/hadoop_filesystem.cc

+5
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ hdfsFS Connect(tf_hdfs_filesystem::HadoopFileSystemImplementation* hadoop_file,
541541
std::string path_har = path;
542542
SplitArchiveNameAndPath(&path_har, &namenode, status);
543543
if (TF_GetCode(status) != TF_OK) return nullptr;
544+
} else if (scheme == "gvfs") {
545+
std::string dfsPath = path;
546+
size_t pos = dfsPath.find(hdfs_path);
547+
dfsPath.replace(pos, dfsPath.length(), "");
548+
namenode = dfsPath + "/";
544549
} else {
545550
if (namenode.empty()) {
546551
namenode = "default";

0 commit comments

Comments
 (0)