Skip to content

Commit aae92bc

Browse files
committed
safer
1 parent 2a9c607 commit aae92bc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

pyiceberg/table/maintenance.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ def _orphaned_files(self, location: str, older_than: Optional[timedelta] = None)
6060

6161
from pyiceberg.io.pyarrow import PyArrowFileIO
6262

63+
if not isinstance(self.tbl.io, PyArrowFileIO):
64+
raise TypeError("MaintenanceTable can only be used with PyArrowFileIO")
65+
6366
all_known_files = self.tbl.inspect._all_known_files()
6467
flat_known_files: set[str] = reduce(set.union, all_known_files.values(), set())
6568

66-
scheme, _, _ = PyArrowFileIO.parse_location(location)
67-
pyarrow_io = PyArrowFileIO()
68-
fs = pyarrow_io.fs_by_scheme(scheme, None)
69+
scheme, _, _ = self.tbl.io.parse_location(location)
70+
fs = self.tbl.io.fs_by_scheme(scheme, None)
6971

70-
_, _, path = pyarrow_io.parse_location(location)
72+
_, _, path = self.tbl.io.parse_location(location)
7173
selector = FileSelector(path, recursive=True)
7274

7375
# filter to just files as it may return directories, and filter on time

0 commit comments

Comments
 (0)