Skip to content

Commit

Permalink
Handle Python3 strings correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Jun 4, 2016
1 parent 066c08a commit 4a80116
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/pyarrow/parquet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ from pyarrow.includes.libarrow cimport *
cimport pyarrow.includes.pyarrow as pyarrow
from pyarrow.includes.parquet cimport *

from pyarrow.compat import tobytes
from pyarrow.error cimport check_cstatus
from pyarrow.table cimport Table

Expand All @@ -40,7 +41,7 @@ def read_table(filename, columns=None):
# Must be in one expression to avoid calling std::move which is not possible
# in Cython (due to missing rvalue support)
reader = unique_ptr[FileReader](new FileReader(default_memory_pool(),
ParquetFileReader.OpenFile(filename)))
ParquetFileReader.OpenFile(tobytes(filename))))
check_cstatus(reader.get().ReadFlatTable(&ctable))
table.init(ctable)
return table
Expand All @@ -58,7 +59,8 @@ def write_table(table, filename, chunk_size=None):
"""
cdef Table table_ = table
cdef CTable* ctable_ = table_.table
cdef shared_ptr[OutputStream] sink = shared_ptr[OutputStream](new LocalFileOutputStream(filename))
cdef shared_ptr[OutputStream] sink = shared_ptr[OutputStream](
new LocalFileOutputStream(tobytes(filename)))
cdef int64_t chunk_size_ = 0
if chunk_size is None:
chunk_size_ = min(ctable_.num_rows(), int(2**16))
Expand Down

0 comments on commit 4a80116

Please sign in to comment.