You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
count() and plan_files() return nothing for an expired snapshot id #4197
Currently, plan_files() returns no tasks when the scan's snapshot_id names no snapshot, so count() of an expired snapshot is 0. to_arrow() on the same scan raises.
importtempfileimportpyarrowaspafrompyiceberg.catalog.sqlimportSqlCatalogcat=SqlCatalog("c", uri="sqlite:///:memory:", warehouse=f"file://{tempfile.mkdtemp()}")
cat.create_namespace("ns")
t=cat.create_table("ns.t", schema=pa.schema([("x", pa.int64())]))
t.append(pa.table({"x": [1, 2]}))
s1=t.current_snapshot().snapshot_idt.append(pa.table({"x": [3]}))
t.maintenance.expire_snapshots().by_id(s1).commit()
print(t.scan(snapshot_id=s1).count(), list(t.scan(snapshot_id=s1).plan_files()))
# 0 [], should raise like to_arrow()t.scan(snapshot_id=s1).to_arrow()
# ValueError: Snapshot not found: 295003531889393679
An id the table never had does the same.
tested on pyiceberg 0.12.0 and main
Willingness to contribute
I can contribute a fix for this bug independently
I would be willing to contribute a fix for this bug with guidance from the Iceberg community
I cannot contribute a fix for this bug at this time
Thanks for the report and the clear repro! I've opened #4218 for this and I'm taking it (´。• ᵕ •。) plan_files()andcount()now raiseSnapshot not foundfor an id that is not in the metadata, the same errorto_arrow()` already raises ʕ•ᴥ•ʔ
Activity
dragonknightk commentedon Oct 31, 2026
Thanks for the report and the clear repro! I've opened #4218 for this and I'm taking it (´。• ᵕ •。
)plan_files()andcount()now raiseSnapshot not foundfor an id that is not in the metadata, the same errorto_arrow()` already raises ʕ•ᴥ•ʔ