rambleraptor commented on code in PR #3478:
URL: https://github.com/apache/iceberg-python/pull/3478#discussion_r4212131882


##########
pyiceberg/table/__init__.py:
##########
@@ -2232,17 +2233,17 @@ class FileScanTask(ScanTask):
     """Task representing a data file and its corresponding delete files."""
 
     file: DataFile
-    delete_files: set[DataFile]
+    delete_files: DeleteFileSet

Review Comment:
   This is going to change the API surface, since DeleteFileSet is a 
MutableSet, not a regular set.
   
   Sets have a whole mess of built-in methods and we don't want to replicate 
all of them. 



##########
pyiceberg/table/delete_file.py:
##########
@@ -0,0 +1,96 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from collections.abc import Iterable, Iterator, MutableSet
+from dataclasses import dataclass
+from typing import Any
+
+from pyiceberg.manifest import DataFile
+
+
+@dataclass(frozen=True, slots=True)
+class DeleteFileKey:
+    """Identity of a delete file, including its referenced content range."""
+
+    file_path: str
+    content_offset: int | None
+    content_size_in_bytes: int | None
+
+    @classmethod
+    def from_file(cls, delete_file: DataFile) -> DeleteFileKey:
+        """Create a key from a delete file."""
+        return cls(
+            file_path=delete_file.file_path,
+            content_offset=delete_file.content_offset,
+            content_size_in_bytes=delete_file.content_size_in_bytes,
+        )
+
+
+class DeleteFileSet(MutableSet[DataFile]):

Review Comment:
   Could we make this a frozenset?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to