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

   ### Apache Iceberg version
   
   0.12.0 (latest release)
   
   ### Please describe the bug 🐞
   
   Currently, a commit retry replays the `upsert`'s append, and 
`_FastAppendFiles._validate_concurrency` checks nothing, so a key another 
writer inserted after the read is inserted a second time. 0.11.1 raises 
`CommitFailedException` here.
   
   ```python
   import tempfile
   import pyarrow as pa
   from pyiceberg.catalog.sql import SqlCatalog
   from pyiceberg.schema import Schema
   from pyiceberg.types import LongType, NestedField, StringType
   
   cat = SqlCatalog("c", uri="sqlite:///:memory:", 
warehouse=f"file://{tempfile.mkdtemp()}")
   cat.create_namespace("ns")
   schema = Schema(NestedField(1, "k", LongType(), required=True), 
NestedField(2, "v", StringType()), identifier_field_ids=[1])
   t = cat.create_table("ns.t", schema=schema)
   row = lambda k, v: pa.Table.from_pylist([{"k": k, "v": v}], 
schema=schema.as_arrow())
   t.append(row(1, "a"))
   
   a = cat.load_table("ns.t")
   b = cat.load_table("ns.t")
   b.upsert(row(2, "b"))
   a.upsert(row(2, "a"))
   # Commit failed due to a concurrent update, retrying (1/4) in 106 ms
   print(sorted(cat.load_table("ns.t").scan().to_arrow().to_pylist(), key=str))
   # [{'k': 1, 'v': 'a'}, {'k': 2, 'v': 'a'}, {'k': 2, 'v': 'b'}], should hold 
k 2 once
   ```
   
   Two writers calling `add_files` on the same file register it twice the same 
way, and every row in it reads back twice.
   
   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