Skip to content
Closed
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
5 changes: 5 additions & 0 deletions python/pyarrow/_parquet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ cdef class ParquetWriter:
cdef:
unique_ptr[FileWriter] writer
shared_ptr[OutputStream] sink
bint own_sink

cdef readonly:
object use_dictionary
Expand All @@ -588,8 +589,10 @@ cdef class ParquetWriter:
check_status(FileOutputStream.Open(c_where,
&filestream))
self.sink = <shared_ptr[OutputStream]> filestream
self.own_sink = True
else:
get_writer(where, &self.sink)
self.own_sink = False

self.use_dictionary = use_dictionary
self.compression = compression
Expand Down Expand Up @@ -664,6 +667,8 @@ cdef class ParquetWriter:
def close(self):
with nogil:
check_status(self.writer.get().Close())
if self.own_sink:
check_status(self.sink.get().Close())

def write_table(self, Table table, row_group_size=None):
cdef CTable* ctable = table.table
Expand Down
3 changes: 0 additions & 3 deletions python/pyarrow/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,9 +1202,6 @@ def test_write_error_deletes_incomplete_file(tmpdir):
except pa.ArrowException:
pass

# Ensure that object has been destructed; this causes test failures on
# Windows
gc.collect()
assert not os.path.exists(filename)


Expand Down