zhaohaisun commented on issue #55877:
URL: https://github.com/apache/arrow/issues/55877#issuecomment-7307960888

   The same simplification also returns rows that the filter excludes, when the 
guarantee comes from a fragment's `partition_expression` instead of Parquet 
row-group statistics. delta-rs builds such expressions from the Delta log 
min/max, so `DeltaTable.to_pyarrow_dataset()` / `to_pyarrow_table(filters=...)` 
are affected:
   
   ```python
   import pyarrow as pa, pyarrow.compute as pc
   from deltalake import DeltaTable, write_deltalake
   
   for i, v in enumerate((0.1, 5.0)):
       write_deltalake("t", pa.table({"id": pa.array([i], pa.int64()), "x": 
pa.array([v], pa.float32())}), mode="append")
   d = DeltaTable("t").to_pyarrow_dataset()
   full = d.to_table()
   e = ~pc.field("x").isin([0.1])
   full.filter(e)["id"].to_pylist()          # [1]
   d.to_table(filter=e)["id"].to_pylist()    # [0, 1]  <- the 0.1 row is 
returned
   DeltaTable("t").to_pyarrow_table(filters=[("x", "not in", 
[0.1])])["id"].to_pylist()  # [0, 1]
   ```
   
   For the file holding `0.1f`, `SimplifyIsIn` drops `0.1` from the value set 
(compared as double against the bound), `is_in` becomes `false`, and `~is_in` 
becomes `true`, so that file is not filtered at all. deltalake 1.7.0, pyarrow 
26.0.1.
   


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

Reply via email to