gabeiglio commented on code in PR #3011:
URL: https://github.com/apache/iceberg-python/pull/3011#discussion_r2826931047
##########
pyiceberg/table/update/snapshot.py:
##########
@@ -366,6 +359,35 @@ def new_manifest_output(self) -> OutputFile:
def fetch_manifest_entry(self, manifest: ManifestFile, discard_deleted:
bool = True) -> list[ManifestEntry]:
return manifest.fetch_manifest_entry(io=self._io,
discard_deleted=discard_deleted)
+ def _build_partition_projection(self, spec_id: int) -> BooleanExpression:
+ project = inclusive_projection(self.schema(), self.spec(spec_id),
self._case_sensitive)
+ return project(self._predicate)
+
+ @cached_property
+ def partition_filters(self) -> KeyDefaultDict[int, BooleanExpression]:
+ return KeyDefaultDict(self._build_partition_projection)
+
+ def _build_manifest_evaluator(self, spec_id: int) ->
Callable[[ManifestFile], bool]:
+ return manifest_evaluator(self.spec(spec_id), self.schema(),
self.partition_filters[spec_id], self._case_sensitive)
+
+ def delete_by_predicate(self, predicate: BooleanExpression,
case_sensitive: bool = True) -> None:
+ self._predicate = Or(self._predicate, predicate)
+ self._case_sensitive = case_sensitive
+
+ def _build_delete_files_partition_predicate(self) -> None:
+ """Build BooleanExpression based on deleted data files partitions."""
+ partition_to_overwrite: dict[int, set[Record]] = {}
+ for data_file in self._deleted_data_files:
+ group = partition_to_overwrite.setdefault(data_file.spec_id, set())
+ group.add(data_file.partition)
+
+ for spec_id, data_files in partition_to_overwrite.items():
Review Comment:
ups, good catch
--
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]