RyanLin5967 opened a new issue, #4197:
URL: https://github.com/apache/iceberg-python/issues/4197
### Apache Iceberg version
0.12.0 (latest release)
### Please describe the bug 🐞
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.
```python
import tempfile
import pyarrow as pa
from pyiceberg.catalog.sql import SqlCatalog
cat = 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_id
t.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
--
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]