westonpace commented on issue #36719:
URL: https://github.com/apache/arrow/issues/36719#issuecomment-1641197938
Python considers `1e8` to be a `float` and not an `int`:
```
>>> import pyarrow as pa
>>> pa.array([1e8])
<pyarrow.lib.DoubleArray object at 0x7fbfe5933b20>
[
100000000
]
>>> pa.array([100000000])
<pyarrow.lib.Int64Array object at 0x7fbfe5933ca0>
[
100000000
]
>>> type(1e8)
<class 'float'>
>>> type(100000000)
<class 'int'>
```
So then arrow sees:
`int64_field / double_literal`.
Arrow refactors this into...
```
cast(int64_field, float32) / cast(double_literal, float32)
```
The expression`cast(int64_field, float32)` is then failing because
`100000001` is outside the range of integers that can be safely cast to floats.
One fix would be:
```
table = ds.dataset('mre.parquet').to_table(filter=ds.field('amount') /
int(1e8) > 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]