Skip to content

Commit e15ca62

Browse files
andylou2tfx-copybara
authored andcommitted
Add arrow dependency.
PiperOrigin-RevId: 303415508
1 parent 08f8e5b commit e15ca62

File tree

6 files changed

+10177
-0
lines changed

6 files changed

+10177
-0
lines changed

WORKSPACE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ git_repository(
3434
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
3535
boost_deps()
3636

37+
http_archive(
38+
name = "com_github_google_flatbuffers",
39+
sha256 = "12a13686cab7ffaf8ea01711b8f55e1dbd3bf059b7c46a25fefa1250bdd9dd23",
40+
strip_prefix = "flatbuffers-b99332efd732e6faf60bb7ce1ce5902ed65d5ba3",
41+
urls = [
42+
"https://mirror.bazel.build/github.com/google/flatbuffers/archive/b99332efd732e6faf60bb7ce1ce5902ed65d5ba3.tar.gz",
43+
"https://github.com/google/flatbuffers/archive/b99332efd732e6faf60bb7ce1ce5902ed65d5ba3.tar.gz",
44+
],
45+
)
46+
3747
# LINT.IfChange(thrift_archive_version)
3848
http_archive(
3949
name = "thrift",
@@ -58,6 +68,18 @@ http_archive(
5868
)
5969
# LINT.ThenChange(third_party/snappy.BUILD:snappy_gen_version)
6070

71+
# LINT.IfChange(arrow_archive_version)
72+
http_archive(
73+
name = "arrow",
74+
build_file = "//third_party:arrow.BUILD",
75+
sha256 = "d7b3838758a365c8c47d55ab0df1006a70db951c6964440ba354f81f518b8d8d",
76+
strip_prefix = "arrow-apache-arrow-0.16.0",
77+
urls = [
78+
"https://github.com/apache/arrow/archive/apache-arrow-0.16.0.tar.gz",
79+
],
80+
)
81+
# LINT.ThenChange(third_party/arrow.BUILD:parquet_gen_version)
82+
6183
# https://github.com/protocolbuffers/protobuf/tree/v3.8.0
6284
PROTOBUF_COMMIT="09745575a923640154bcf307fba8aedff47f240a"
6385

third_party/BUILD

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Description:
16+
# librarys for exposing vendored files in third_party.
17+
18+
licenses(["notice"]) # Apache 2.0
19+
20+
exports_files([
21+
"parquet/parquet_types.cpp",
22+
])
23+
24+
cc_library(
25+
name = "parquet_types_h",
26+
hdrs = ["parquet/parquet_types.h"],
27+
includes = ["."],
28+
visibility = ["//visibility:public"],
29+
)

third_party/arrow.BUILD

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Description:
16+
# Apache arrow library
17+
18+
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
19+
20+
flatbuffer_cc_library(
21+
name = "arrow_format",
22+
srcs = [
23+
"cpp/src/arrow/ipc/feather.fbs",
24+
"format/File.fbs",
25+
"format/Message.fbs",
26+
"format/Schema.fbs",
27+
"format/SparseTensor.fbs",
28+
"format/Tensor.fbs",
29+
],
30+
flatc_args = [
31+
"--scoped-enums",
32+
"--gen-object-api",
33+
],
34+
out_prefix = "cpp/src/generated/",
35+
)
36+
37+
package(default_visibility = ["//visibility:public"])
38+
39+
genrule(
40+
name = "arrow_util_config",
41+
srcs = ["cpp/src/arrow/util/config.h.cmake"],
42+
outs = ["cpp/src/arrow/util/config.h"],
43+
cmd = ("sed " +
44+
"-e 's/@ARROW_VERSION_MAJOR@/0/g' " +
45+
"-e 's/@ARROW_VERSION_MINOR@/16/g' " +
46+
"-e 's/@ARROW_VERSION_PATCH@/0/g' " +
47+
"-e 's/cmakedefine/define/g' " +
48+
"$< >$@"),
49+
)
50+
51+
# LINT.IfChange(parquet_gen_version)
52+
genrule(
53+
name = "parquet_version_h",
54+
srcs = ["cpp/src/parquet/parquet_version.h.in"],
55+
outs = ["cpp/src/parquet/parquet_version.h"],
56+
cmd = ("sed " +
57+
"-e 's/@PARQUET_VERSION_MAJOR@/1/g' " +
58+
"-e 's/@PARQUET_VERSION_MINOR@/5/g' " +
59+
"-e 's/@PARQUET_VERSION_PATCH@/1/g' " +
60+
"$< >$@"),
61+
)
62+
# LINT.ThenChange(../WORKSPACE:arrow_archive_version)
63+
64+
cc_library(
65+
name = "arrow",
66+
srcs = glob(
67+
[
68+
"cpp/src/arrow/*.cc",
69+
"cpp/src/arrow/array/*.cc",
70+
"cpp/src/arrow/csv/*.cc",
71+
"cpp/src/arrow/io/*.cc",
72+
"cpp/src/arrow/util/*.cc",
73+
"cpp/src/arrow/util/compression_snappy.h",
74+
"cpp/src/arrow/util/compression_snappy.cc",
75+
"cpp/src/arrow/compute/**/*.cc",
76+
"cpp/src/arrow/compute/**/*.h",
77+
"cpp/src/arrow/vendored/optional.hpp",
78+
"cpp/src/arrow/vendored/string_view.hpp",
79+
"cpp/src/arrow/vendored/variant.hpp",
80+
"cpp/src/arrow/vendored/**/*.cpp",
81+
"cpp/src/arrow/vendored/**/*.hpp",
82+
"cpp/src/arrow/vendored/**/*.cc",
83+
"cpp/src/arrow/vendored/**/*.c",
84+
"cpp/src/arrow/vendored/**/*.h",
85+
"cpp/src/arrow/ipc/*.cc",
86+
"cpp/src/arrow/ipc/*.h",
87+
"cpp/src/arrow/**/*.h",
88+
"cpp/src/parquet/**/*.h",
89+
"cpp/src/parquet/**/*.cc",
90+
],
91+
exclude = [
92+
"cpp/src/arrow/util/compression_brotli*",
93+
"cpp/src/arrow/util/compression_bz2*",
94+
"cpp/src/arrow/util/compression_lz4*",
95+
"cpp/src/arrow/util/compression_z*",
96+
"cpp/src/**/*_benchmark.cc",
97+
"cpp/src/**/*_main.cc",
98+
"cpp/src/**/*_nossl.cc",
99+
"cpp/src/**/*_test.cc",
100+
"cpp/src/**/*-test.cc",
101+
"cpp/src/**/test_*.cc",
102+
"cpp/src/**/*hdfs*.cc",
103+
"cpp/src/**/*fuzz*.cc",
104+
"cpp/src/**/file_to_stream.cc",
105+
"cpp/src/**/stream_to_file.cc",
106+
"cpp/src/arrow/ipc/json*.cc",
107+
"cpp/src/arrow/vendored/xxhash/**",
108+
],
109+
) + [
110+
"@struct2tensor//third_party:parquet/parquet_types.cpp",
111+
],
112+
hdrs = [
113+
# declare header from above genrule
114+
"cpp/src/arrow/util/config.h",
115+
"cpp/src/parquet/parquet_version.h",
116+
],
117+
defines = [
118+
# LINT.IfChange
119+
"ARROW_WITH_SNAPPY",
120+
# LINT.ThenChange(../WORKSPACE:snappy_archive_version)
121+
],
122+
includes = [
123+
"cpp/src",
124+
"cpp/src/arrow/vendored/xxhash",
125+
],
126+
textual_hdrs = [
127+
"cpp/src/arrow/vendored/xxhash/xxhash.c",
128+
],
129+
deps = [
130+
":arrow_format",
131+
"@snappy",
132+
"@struct2tensor//third_party:parquet_types_h",
133+
"@thrift",
134+
],
135+
)

third_party/parquet/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Parquet Vendored Files
2+
3+
The files in this directory are generated by the thrift compiler from
4+
[parquet.thrift](https://github.com/apache/arrow/blob/master/cpp/src/parquet/parquet.thrift)
5+
We vendor these files so we don't need to bring in the entire thrift compiler
6+
as a dependency.
7+
8+
These files are copied from [Tensorflow I/O](https://github.com/tensorflow/io/tree/227379d2d260667f2b74a3d5052c2b9044312d4a/third_party/parquet).

0 commit comments

Comments
 (0)