diff --git a/python/pyarrow/parquet.pyx b/python/pyarrow/parquet.pyx index 1dcfd60bee67e..39f5b229884bf 100644 --- a/python/pyarrow/parquet.pyx +++ b/python/pyarrow/parquet.pyx @@ -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 @@ -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 @@ -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))