Skip to content

Commit 3ec83fc

Browse files
committed
fix: issue with unset writer
1 parent 87c44a4 commit 3ec83fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pyiceberg/manifest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,12 @@ def __exit__(
926926
self._current_writer.__exit__(exc_type, exc_value, traceback)
927927

928928
def _get_current_writer(self) -> ManifestWriter:
929+
if self._should_roll_to_new_file():
930+
self._close_current_writer()
929931
if not self._current_writer:
930932
self._current_writer = next(self._supplier)
931933
self._current_writer.__enter__()
932934
return self._current_writer
933-
if self._should_roll_to_new_file():
934-
self._close_current_writer()
935935
return self._current_writer
936936

937937
def _should_roll_to_new_file(self) -> bool:
@@ -958,6 +958,7 @@ def add_entry(self, entry: ManifestEntry) -> RollingManifestWriter:
958958
if self._closed:
959959
raise RuntimeError("Cannot add entry to closed manifest writer")
960960
self._get_current_writer().add_entry(entry)
961+
self._current_file_rows += entry.data_file.record_count
961962
return self
962963

963964

0 commit comments

Comments
 (0)