Skip to content

Commit

Permalink
Rename read_parquet_columns => list_parquet_columns
Browse files Browse the repository at this point in the history
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed Jul 31, 2019
1 parent cf479f1 commit c493791
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions tensorflow_io/parquet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@@ParquetDataset
@@read_parquet
@@read_parquet_columns
@@list_parquet_columns
"""

from __future__ import absolute_import
Expand All @@ -25,14 +25,14 @@

from tensorflow_io.parquet.python.ops.parquet_ops import ParquetDataset
from tensorflow_io.parquet.python.ops.parquet_ops import read_parquet
from tensorflow_io.parquet.python.ops.parquet_ops import read_parquet_columns
from tensorflow_io.parquet.python.ops.parquet_ops import list_parquet_columns

from tensorflow.python.util.all_util import remove_undocumented

_allowed_symbols = [
"ParquetDataset",
"read_parquet",
"read_parquet_columns",
"list_parquet_columns",
]

remove_undocumented(__name__, allowed_exception_list=_allowed_symbols)
8 changes: 4 additions & 4 deletions tensorflow_io/parquet/kernels/parquet_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class ParquetRandomAccessFile : public ::arrow::io::RandomAccessFile {
int64 size_;
};

class ReadParquetColumnsOp : public OpKernel {
class ListParquetColumnsOp : public OpKernel {
public:
explicit ReadParquetColumnsOp(OpKernelConstruction* context) : OpKernel(context) {
explicit ListParquetColumnsOp(OpKernelConstruction* context) : OpKernel(context) {
env_ = context->env();
}

Expand Down Expand Up @@ -309,8 +309,8 @@ class ReadParquetOp : public OpKernel {
Env* env_ GUARDED_BY(mu_);
};

REGISTER_KERNEL_BUILDER(Name("ReadParquetColumns").Device(DEVICE_CPU),
ReadParquetColumnsOp);
REGISTER_KERNEL_BUILDER(Name("ListParquetColumns").Device(DEVICE_CPU),
ListParquetColumnsOp);
REGISTER_KERNEL_BUILDER(Name("ReadParquet").Device(DEVICE_CPU),
ReadParquetOp);

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_io/parquet/ops/parquet_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.

namespace tensorflow {

REGISTER_OP("ReadParquetColumns")
REGISTER_OP("ListParquetColumns")
.Input("filename: string")
.Input("memory: string")
.Output("columns: string")
Expand Down
8 changes: 4 additions & 4 deletions tensorflow_io/parquet/python/ops/parquet_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
from tensorflow_io.core.python.ops import core_ops as parquet_ops
from tensorflow_io.core.python.ops import data_ops

def read_parquet_columns(filename, **kwargs):
"""read_parquet_columns"""
def list_parquet_columns(filename, **kwargs):
"""list_parquet_columns"""
if not tf.executing_eagerly():
raise NotImplementedError("read_parquet_spect only support eager mode")
memory = kwargs.get("memory", "")
columns, dtypes, shapes = parquet_ops.read_parquet_columns(
columns, dtypes, shapes = parquet_ops.list_parquet_columns(
filename, memory=memory)
entries = zip(tf.unstack(columns), tf.unstack(dtypes), tf.unstack(shapes))
return dict([(column.numpy().decode(), tf.TensorSpec(
Expand Down Expand Up @@ -58,7 +58,7 @@ def __init__(self, filename, column, batch=None, **kwargs):
count = kwargs.get("count")
dtype = kwargs.get("dtype")
else:
columns = read_parquet_columns(filename)
columns = list_parquet_columns(filename)
count = columns[column].shape[0]
dtype = columns[column].dtype

Expand Down
2 changes: 1 addition & 1 deletion tests/test_parquet_eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_parquet():
"parquet_cpp_example.parquet")
filename = "file://" + filename

specs = parquet_io.read_parquet_columns(filename)
specs = parquet_io.list_parquet_columns(filename)
columns = [
'boolean_field',
'int32_field',
Expand Down

0 comments on commit c493791

Please sign in to comment.