Skip to content

Commit a38c35d

Browse files
authored
Initial commit of hadoop file system (credit vnvo2409) (tensorflow#1197)
* Initial commit of hadoop file system Signed-off-by: Yong Tang <[email protected]> * Update namespace to avoid collision/conflict Signed-off-by: Yong Tang <[email protected]> * Add a wrapper to HadoopFileSystem so that it will only be lazily loaded. Signed-off-by: Yong Tang <[email protected]> * Address review comments Signed-off-by: Yong Tang <[email protected]>
1 parent 261a5c3 commit a38c35d

File tree

7 files changed

+1006
-1
lines changed

7 files changed

+1006
-1
lines changed

WORKSPACE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,3 +1052,14 @@ http_archive(
10521052
"https://pilotfiber.dl.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz",
10531053
],
10541054
)
1055+
1056+
http_archive(
1057+
name = "hadoop",
1058+
build_file = "//third_party:hadoop.BUILD",
1059+
sha256 = "5fd5831b12b1e0999bd352d6cca11ef80f883c81ffa898e53c68d8fe8d170e9f",
1060+
strip_prefix = "hadoop-3.3.0-src",
1061+
urls = [
1062+
"https://storage.googleapis.com/mirror.tensorflow.org/downloads.apache.org/hadoop/common/hadoop-3.3.0/hadoop-3.3.0-src.tar.gz",
1063+
"https://downloads.apache.org/hadoop/common/hadoop-3.3.0/hadoop-3.3.0-src.tar.gz",
1064+
],
1065+
)

tensorflow_io/core/plugins/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ cc_library(
3030
linkstatic = True,
3131
deps = [
3232
"//tensorflow_io/core/plugins/az",
33+
"//tensorflow_io/core/plugins/hdfs",
3334
"//tensorflow_io/core/plugins/http",
3435
"//tensorflow_io/core/plugins/s3",
3536
],

tensorflow_io/core/plugins/file_system_plugins.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ limitations under the License.
1818
void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
1919
info->plugin_memory_allocate = tensorflow::io::plugin_memory_allocate;
2020
info->plugin_memory_free = tensorflow::io::plugin_memory_free;
21-
info->num_schemes = 3;
21+
info->num_schemes = 4;
2222
info->ops = static_cast<TF_FilesystemPluginOps*>(
2323
tensorflow::io::plugin_memory_allocate(info->num_schemes *
2424
sizeof(info->ops[0])));
2525
tensorflow::io::az::ProvideFilesystemSupportFor(&info->ops[0], "az");
2626
tensorflow::io::http::ProvideFilesystemSupportFor(&info->ops[1], "http");
2727
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[2], "s3e");
28+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[3], "hdfse");
2829
}

tensorflow_io/core/plugins/file_system_plugins.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ void ProvideFilesystemSupportFor(TF_FilesystemPluginOps* ops, const char* uri);
3232

3333
} // namespace az
3434

35+
namespace hdfs {
36+
37+
void ProvideFilesystemSupportFor(TF_FilesystemPluginOps* ops, const char* uri);
38+
39+
} // namespace hdfs
40+
3541
namespace http {
3642

3743
void ProvideFilesystemSupportFor(TF_FilesystemPluginOps* ops, const char* uri);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
licenses(["notice"]) # Apache 2.0
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
load(
6+
"//:tools/build/tensorflow_io.bzl",
7+
"tf_io_copts",
8+
)
9+
10+
cc_library(
11+
name = "hdfs",
12+
srcs = [
13+
"hadoop_filesystem.cc",
14+
],
15+
copts = tf_io_copts(),
16+
linkstatic = True,
17+
deps = [
18+
"//tensorflow_io/core/plugins:plugins_header",
19+
"@hadoop",
20+
],
21+
alwayslink = 1,
22+
)

0 commit comments

Comments
 (0)