zhaohaisun opened a new issue, #55877:
URL: https://github.com/apache/arrow/issues/55877
### Describe the bug, including details regarding any error messages,
version, and platform.
`is_in` on a Parquet dataset drops matching rows, or raises, when the value
set has a different type than the column. `Table.filter` with the same
expression returns the rows.
```python
import pyarrow as pa
import pyarrow.compute as pc
import pyarrow.dataset as ds
import pyarrow.parquet as pq
t = pa.table({"x": pa.array([0.1, 5.0], pa.float32())})
pq.write_table(t, "t.parquet")
e = pc.field("x").isin([0.1])
print(t.filter(e)["x"].to_pylist())
# [0.10000000149011612]
print(ds.dataset("t.parquet").to_table(filter=e)["x"].to_pylist())
# []
print(pq.read_table("t.parquet", filters=[("x", "in",
[0.1])])["x"].to_pylist()) # []
```
The value set is `double`. When `is_in` executes, the value set is cast to
the column type, so `0.1` matches the stored `float32` value. During row-group
pruning, `SimplifyIsIn` (`cpp/src/arrow/compute/expression.cc`) compares the
value set as it is with the statistics bound: `0.1 < double(0.1f)`, the
row-group minimum, so the value is filtered out of the set, the set becomes
empty, the predicate simplifies to `false`, and the row group is skipped.
The same comparison makes dataset scans fail where `Table.filter` works:
```python
# float32 column, string value set
e = pc.field("x").isin(pa.array(["0.1"]))
t.filter(e) # [0.10000000149011612]
ds.dataset("t.parquet").to_table(filter=e)
# ArrowNotImplementedError: Function 'greater_equal' has no kernel matching
input types (string, float)
# float32 column, int64 value set
t2 = pa.table({"x": pa.array([16777216.0, 16777218.0], pa.float32())})
pq.write_table(t2, "t2.parquet")
e = pc.field("x").isin(pa.array([16777217], pa.int64()))
t2.filter(e) # 0 rows
ds.dataset("t2.parquet").to_table(filter=e)
# ArrowInvalid: Integer value 16777217 not in range: -16777216 to 16777216
```
A `date32` column with a `timestamp[us]` value set `[2024-01-03
00:00:00.000001]` also differs: `Table.filter` returns the row `2024-01-03`,
the dataset scan returns nothing.
Casting the value set to the field type before comparing it with the
guarantee (as `is_in` does at execution), or not simplifying when the types
differ, would make the two paths agree.
Environment: pyarrow 26.0.1, Python 3.11, Linux x86_64. `SimplifyIsIn` is
unchanged on main (last change to `expression.cc` is 5ef3c52003, 2026-10-09).
This is a regression: 17.0.0 returns the row from the dataset scan, 18.0.0 and
later (18, 19, 20, 21, 26.0.1) do not. `SimplifyIsIn` was added by GH-43187
(#43761, merged 2024-09-10), which is in 18.0.0.
### Component(s)
C++, Python
--
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]