|
29 | 29 | from pyiceberg.manifest import DataFile, DataFileContent, ManifestFile, _manifests |
30 | 30 | from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec |
31 | 31 | from pyiceberg.schema import Schema |
32 | | -from pyiceberg.utils.deprecated import deprecation_message |
33 | 32 |
|
34 | 33 | if TYPE_CHECKING: |
35 | 34 | from pyiceberg.table.metadata import TableMetadata |
@@ -344,54 +343,10 @@ def _partition_summary(self, update_metrics: UpdateMetrics) -> str: |
344 | 343 | return ",".join([f"{prop}={val}" for prop, val in update_metrics.to_dict().items()]) |
345 | 344 |
|
346 | 345 |
|
347 | | -def _truncate_table_summary(summary: Summary, previous_summary: Mapping[str, str]) -> Summary: |
348 | | - for prop in { |
349 | | - TOTAL_DATA_FILES, |
350 | | - TOTAL_DELETE_FILES, |
351 | | - TOTAL_RECORDS, |
352 | | - TOTAL_FILE_SIZE, |
353 | | - TOTAL_POSITION_DELETES, |
354 | | - TOTAL_EQUALITY_DELETES, |
355 | | - }: |
356 | | - summary[prop] = "0" |
357 | | - |
358 | | - def get_prop(prop: str) -> int: |
359 | | - value = previous_summary.get(prop) or "0" |
360 | | - try: |
361 | | - return int(value) |
362 | | - except ValueError as e: |
363 | | - raise ValueError(f"Could not parse summary property {prop} to an int: {value}") from e |
364 | | - |
365 | | - if value := get_prop(TOTAL_DATA_FILES): |
366 | | - summary[DELETED_DATA_FILES] = str(value) |
367 | | - if value := get_prop(TOTAL_DELETE_FILES): |
368 | | - summary[REMOVED_DELETE_FILES] = str(value) |
369 | | - if value := get_prop(TOTAL_RECORDS): |
370 | | - summary[DELETED_RECORDS] = str(value) |
371 | | - if value := get_prop(TOTAL_FILE_SIZE): |
372 | | - summary[REMOVED_FILE_SIZE] = str(value) |
373 | | - if value := get_prop(TOTAL_POSITION_DELETES): |
374 | | - summary[REMOVED_POSITION_DELETES] = str(value) |
375 | | - if value := get_prop(TOTAL_EQUALITY_DELETES): |
376 | | - summary[REMOVED_EQUALITY_DELETES] = str(value) |
377 | | - |
378 | | - return summary |
379 | | - |
380 | | - |
381 | | -def update_snapshot_summaries( |
382 | | - summary: Summary, previous_summary: Mapping[str, str] | None = None, truncate_full_table: bool = False |
383 | | -) -> Summary: |
| 346 | +def update_snapshot_summaries(summary: Summary, previous_summary: Mapping[str, str] | None = None) -> Summary: |
384 | 347 | if summary.operation not in {Operation.APPEND, Operation.OVERWRITE, Operation.DELETE}: |
385 | 348 | raise ValueError(f"Operation not implemented: {summary.operation}") |
386 | 349 |
|
387 | | - if truncate_full_table and summary.operation == Operation.OVERWRITE and previous_summary is not None: |
388 | | - deprecation_message( |
389 | | - deprecated_in="0.10.0", |
390 | | - removed_in="0.11.0", |
391 | | - help_message="The truncate-full-table shouldn't be used.", |
392 | | - ) |
393 | | - summary = _truncate_table_summary(summary, previous_summary) |
394 | | - |
395 | 350 | if not previous_summary: |
396 | 351 | previous_summary = { |
397 | 352 | TOTAL_DATA_FILES: "0", |
|
0 commit comments