RyanLin5967 opened a new issue, #4188:
URL: https://github.com/apache/iceberg-python/issues/4188
### Apache Iceberg version
0.12.0 (latest release)
### Please describe the bug 🐞
Currently, a commit retry writes the added manifest under the refreshed
default spec, so a file partitioned by `p` gets its `p` value recorded as `q`
and filters on `q` prune it. A handle loaded after the spec change is correct.
```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")
row = lambda x, p, q: pa.table({"x": [x], "p": [p], "q": [q]})
t = cat.create_table("ns.t", schema=row(1, 5, 50).schema)
with t.update_spec() as u:
u.add_identity("p")
b = cat.load_table("ns.t")
with b.update_spec() as u:
u.remove_field("p")
u.add_identity("q")
b.append(row(2, 6, 60))
t.append(row(3, 7, 70))
print(cat.load_table("ns.t").scan(row_filter="q ==
70").to_arrow()["x"].to_pylist())
# [], should be [3]
# t's commit retried after b's append, and its file was recorded under b's
spec as q=7
```
If the new spec has a different number of fields, the append raises
`IndexError`, and `dynamic_partition_overwrite` mislabels its file the same way.
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]