shihchengwei-lab commented on PR #4551:
URL: https://github.com/apache/iceberg-python/pull/4551#issuecomment-7351235030

   A valid float32 update can return `rows_updated=0` and leave the old double 
in the table. I reproduced this on `9e4f8bf` with PyArrow 25.0.1.
   
   ```python
   import pyarrow as pa
   from pyiceberg.catalog.sql import SqlCatalog
   
   def test_upsert_with_float32_input(tmp_path):
       catalog = SqlCatalog("local", uri="sqlite:///:memory:", 
warehouse=tmp_path.as_uri())
       catalog.create_namespace("db")
       old = pa.table({"id": [1], "v": pa.array([16777217], type=pa.float64())})
       table = catalog.create_table("db.t", schema=old.schema)
       table.append(old)
   
       new = pa.table({"id": [1], "v": pa.array([16777216], type=pa.float32())})
       result = table.upsert(new, join_cols=["id"])
       stored = catalog.load_table("db.t").scan().to_arrow()["v"].to_pylist()
       assert (result.rows_updated, stored) == (1, [16777216.0])
   ```
   
   The test passes on base `0bef230`. On the PR it gets `(0, [16777217.0])`. In 
`_align_to_schema`, casting the stored double to float32 rounds it to the 
incoming value before the comparison. Could we keep the alignment by name and 
compare shared columns at a precision that preserves both values?
   
   AI assistance: Codex helped trace the change, run the test on both 
revisions, and draft this comment.


-- 
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