Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ sh_binary(
"//tensorflow_io/ignite:ignite_py",
"//tensorflow_io/kafka:kafka_py",
"//tensorflow_io/kinesis:kinesis_py",
"//tensorflow_io/parquet:parquet_py",
],
)
71 changes: 71 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,74 @@ http_archive(
strip_prefix = "aws-sdk-cpp-1.3.15",
build_file = "//third_party:aws.BUILD",
)

http_archive(
name = "snappy",
urls = [
"https://mirror.bazel.build/github.com/google/snappy/archive/1.1.7.tar.gz",
"https://github.com/google/snappy/archive/1.1.7.tar.gz",
],
sha256 = "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4",
strip_prefix = "snappy-1.1.7",
build_file = "//third_party:snappy.BUILD",
)

http_archive(
name = "arrow",
urls = [
"https://mirror.bazel.build/github.com/apache/arrow/archive/apache-arrow-0.9.0.tar.gz",
"https://github.com/apache/arrow/archive/apache-arrow-0.9.0.tar.gz",
],
sha256 = "65f89a3910b6df02ac71e4d4283db9b02c5b3f1e627346c7b6a5982ae994af91",
strip_prefix = "arrow-apache-arrow-0.9.0",
build_file = "//third_party:arrow.BUILD",
)

http_archive(
name = "boost",
urls = [
"https://mirror.bazel.build/dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz",
"https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz"
],
sha256 = "8aa4e330c870ef50a896634c931adf468b21f8a69b77007e45c444151229f665",
strip_prefix = "boost_1_67_0",
build_file = "//third_party:boost.BUILD",
)

http_archive(
name = "thrift",
urls = [
"https://mirror.bazel.build/github.com/apache/thrift/archive/0.11.0.tar.gz",
"https://github.com/apache/thrift/archive/0.11.0.tar.gz",
],
sha256 = "0e324569321a1b626381baabbb98000c8dd3a59697292dbcc71e67135af0fefd",
strip_prefix = "thrift-0.11.0",
build_file = "//third_party:thrift.BUILD",
)

# Parquet needs generated parquet_types.h and parquet_types.cpp which are generated
# from src/parquet/parquet.thrift in apache-parquet-cpp-1.4.0.tar.gz.
#
# Generating parquet_types.h and parquet_types.cpp, however, needs both bison and flex
# installed, which is really an unnecessary step.
#
# We use the following step to generate the parquet_types.h and parquet_types.cpp files:
# - In third_party directory, run `docker run -i -t --rm -v $PWD:/v -w /v ubuntu:16.04 bash -x /v/parquet.type`
# - Once complete, a parquet.patch file will be generated which could be used as a patch in bazel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this note!

#
# $ cd third_party
# $ docker run -i -t --rm -v $PWD:/v -w /v ubuntu:16.04 bash -x /v/parquet.type
http_archive(
name = "parquet",
urls = [
"https://mirror.bazel.build/github.com/apache/parquet-cpp/archive/apache-parquet-cpp-1.4.0.tar.gz",
"https://github.com/apache/parquet-cpp/archive/apache-parquet-cpp-1.4.0.tar.gz",
],
sha256 = "52899be6c9dc49a14976d4ad84597243696c3fa2882e5c802b56e912bfbcc7ce",
strip_prefix = "parquet-cpp-apache-parquet-cpp-1.4.0",
build_file = "//third_party:parquet.BUILD",
patches = [
"//third_party:parquet.patch",
],
patch_args = ["-p1"],
)
62 changes: 62 additions & 0 deletions tensorflow_io/parquet/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
licenses(["notice"]) # Apache 2.0

package(default_visibility = ["//visibility:public"])

filegroup(
name = "test_data",
srcs = glob(["python/kernel_tests/testdata/*"]),
)

cc_binary(
name = 'python/ops/_parquet_ops.so',
srcs = [
"kernels/parquet_dataset_ops.cc",
"ops/dataset_ops.cc",
],
linkshared = 1,
deps = [
"@local_config_tf//:libtensorflow_framework",
"@local_config_tf//:tf_header_lib",
"@parquet//:parquet",
],
copts = ["-pthread", "-std=c++11", "-D_GLIBCXX_USE_CXX11_ABI=0", "-DNDEBUG"]
)

py_library(
name = "parquet_ops_py",
srcs = ([
"python/ops/parquet_dataset_ops.py",
]),
data = [
":python/ops/_parquet_ops.so"
],
srcs_version = "PY2AND3",
)

py_test(
name = "parquet_py_test",
srcs = [
"python/kernel_tests/parquet_test.py"
],
main = "python/kernel_tests/parquet_test.py",
data = [
":test_data",
],
deps = [
":parquet_ops_py",
],
srcs_version = "PY2AND3",
)

py_library(
name = "parquet_py",
srcs = ([
"__init__.py",
"python/__init__.py",
"python/ops/__init__.py",
]),
deps = [
":parquet_ops_py"
],
srcs_version = "PY2AND3",
)
32 changes: 32 additions & 0 deletions tensorflow_io/parquet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================
"""Parquet Dataset.

@@ParquetDataset
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow_io.parquet.python.ops.parquet_dataset_ops import ParquetDataset

from tensorflow.python.util.all_util import remove_undocumented

_allowed_symbols = [
"ParquetDataset",
]

remove_undocumented(__name__)
Loading