RyanLin5967 opened a new issue, #4193:
URL: https://github.com/apache/iceberg-python/issues/4193

   ### Apache Iceberg version
   
   0.12.0 (latest release)
   
   ### Please describe the bug 🐞
   
   Currently, applying `RemoveSnapshotsUpdate` sets the children's 
`parent_snapshot_id` to None, so the lineage check #3512 added for an expired 
exclusive start never matches and the scan raises. Java keeps the parent id, 
and #3512's test removes the snapshot by hand with the parent id intact.
   
   ```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())]))
   ids = []
   for x in (1, 2, 3):
       t.append(pa.table({"x": [x]}))
       ids.append(t.current_snapshot().snapshot_id)
   
   scan = lambda: 
t.incremental_append_scan(from_snapshot_id_exclusive=ids[0]).to_arrow()["x"].to_pylist()
   print(sorted(scan()))
   # [2, 3]
   t.maintenance.expire_snapshots().by_id(ids[0]).commit()
   print(t.snapshot_by_id(ids[1]).parent_snapshot_id)
   # None, was ids[0]
   print(sorted(scan()))
   # ValueError: Starting snapshot (exclusive) 6945542855238032183 is not a 
parent ancestor of end snapshot 6485958663478198635
   # should be [2, 3]
   ```
   
   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]

Reply via email to