Copilot commented on code in PR #3760:
URL: https://github.com/apache/iceberg-python/pull/3760#discussion_r3734722641
##########
pyiceberg/table/__init__.py:
##########
@@ -212,6 +213,9 @@ class TableProperties:
MIN_SNAPSHOTS_TO_KEEP = "history.expire.min-snapshots-to-keep"
MIN_SNAPSHOTS_TO_KEEP_DEFAULT = 1
+ MAX_REF_AGE_MS = "history.expire.max-ref-age-ms"
+ MAX_REF_AGE_MS_DEFAULT = sys.maxsize
Review Comment:
MAX_REF_AGE_MS_DEFAULT uses sys.maxsize, which is platform-dependent (e.g.,
~2^31-1 on 32-bit). That would make the default ref TTL unexpectedly small and
could cause refs to expire when the table property is unset. Use a stable
64-bit max value to match Iceberg's Long.MAX_VALUE semantics.
##########
tests/table/test_expire_snapshots.py:
##########
@@ -316,3 +322,126 @@ def
test_update_remove_snapshots_with_statistics(table_v2_with_statistics: Table
assert not any(stat.snapshot_id == REMOVE_SNAPSHOT for stat in
new_metadata.statistics), (
"Statistics for removed snapshot should be gone"
)
+
+
+def _table_with_expired_branch(
+ catalog_with_warehouse: Catalog,
+ max_ref_age_ms: int,
+ table_properties: dict[str, str] | None = None,
+) -> tuple[Table, int]:
+ """Create a table with three snapshots and a branch on the oldest, then
wait out its TTL.
+
+ Returns the reloaded table and the snapshot id the branch pins.
+ """
+ catalog_with_warehouse.create_namespace("expire_refs")
Review Comment:
catalog_with_warehouse.create_namespace("expire_refs") will raise
NamespaceAlreadyExistsError when the session-scoped warehouse is reused across
tests/catalog parametrizations. Use create_namespace_if_not_exists (or a unique
namespace per test) to avoid cross-test flakiness.
This issue also appears in the following locations of the same file:
- line 409
- line 433
--
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]