Skip to content

Commit 1c1533a

Browse files
committed
fix if statment
1 parent a43877f commit 1c1533a

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

pyiceberg/io/pyarrow.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,12 +936,20 @@ def _read_delete_file(fs: FileSystem, data_file: DataFile) -> Iterator[PositionD
936936

937937

938938
def _read_deletes(fs: FileSystem, data_file: DataFile) -> Dict[str, pa.ChunkedArray]:
939+
<<<<<<< HEAD
939940
if data_file.file_format == FileFormat.PARQUET:
940941
deletes_by_file: Dict[str, List[int]] = {}
941942
for delete in _read_delete_file(fs, data_file):
942943
if delete.file_path not in deletes_by_file:
943944
deletes_by_file[delete.file_path] = []
944945
deletes_by_file[delete.file_path].append(delete.pos)
946+
=======
947+
deletes_by_file: Dict[str, List[int]] = {}
948+
for delete in _read_delete_file(fs, data_file):
949+
if delete.path not in deletes_by_file:
950+
deletes_by_file[delete.path] = []
951+
deletes_by_file[delete.path].append(delete.pos)
952+
>>>>>>> e4ed25e (fix if statment)
945953

946954
# Convert lists of positions to ChunkedArrays
947955
return {

pyiceberg/manifest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def data_file_with_partition(partition_type: StructType, format_version: TableVe
323323

324324
class PositionDelete(Record):
325325
__slots__ = ("file_path", "pos", "row")
326-
file_path: str
326+
path: str
327327
pos: int
328328
row: Optional[Record]
329329

@@ -333,20 +333,20 @@ def __setattr__(self, name: str, value: Any) -> None:
333333

334334
def __init__(self, file_path: str, pos: int, row: Optional[Record], *data: Any, **named_data: Any) -> None:
335335
super().__init__(*data, **named_data)
336-
self.file_path = file_path
336+
self.path = file_path
337337
self.pos = pos
338338
self.row = row
339339

340340
def __hash__(self) -> int:
341341
"""Return the hash of the file path."""
342-
return hash(self.file_path)
342+
return hash(self.path)
343343

344344
def __eq__(self, other: Any) -> bool:
345345
"""Compare the PositionDelete with another object.
346346
347347
If it is a PositionDelete, it will compare based on the file_path.
348348
"""
349-
return self.file_path == other.file_path if isinstance(other, PositionDelete) else False
349+
return self.path == other.path if isinstance(other, PositionDelete) else False
350350

351351

352352
class DataFile(Record):

pyiceberg/table/inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def _generate_positional_delete_table(self, manifest: ManifestFile, schema: Sche
494494
positional_deletes_records = []
495495
for record in positional_delete_file:
496496
row = {
497-
"file_path": record.file_path,
497+
"file_path": record.path,
498498
"pos": record.pos,
499499
"row": record.row,
500500
"partition": entry.data_file.partition.__dict__,
@@ -769,7 +769,7 @@ def position_deletes(self, snapshot_id: Optional[int] = None) -> "pa.Table":
769769
schema = self._get_positional_deletes_schema()
770770
return pa.Table.from_pylist([], schema=schema)
771771

772-
if not snapshot.schema_id:
772+
if snapshot.schema_id == None:
773773
raise ValueError(f"Snapshot {snapshot.snapshot_id} does not have a schema id")
774774

775775
schemas = self.tbl.schemas()

0 commit comments

Comments
 (0)