dRacz3 opened a new issue, #37956:
URL: https://github.com/apache/arrow/issues/37956
### Describe the bug, including details regarding any error messages,
version, and platform.
I am trying to write a structured data using the following schema.
Using pyarrow==13.0.0
on a MacOS Monterey 12.1, M1 macbook
It seems like, that above a certain value, a floating point number is
written incorrectly to the resulting parquet file. The error seems to depend on
the actual value of the number.
This is the minimum code where I could replicate this behaviour:
```python
import pandas as pd
import pyarrow as pa
schema = pa.schema(
[
pa.field(
name="root",
type=pa.struct(
[
pa.field(name="timestamp", type=pa.float32(),
nullable=True),
]
),
nullable=True,
)
]
)
def test_pyarrow_write_bug():
data = [
{'root': {'timestamp': 1.0}},
{'root': {'timestamp': 1693260000.0}},
{'root': {'timestamp': 846630000.0}},
{'root': {'timestamp': 423315000.0}},
{'root': {'timestamp': 211657500.0}},
{'root': {'timestamp': 105828750.0}},
{'root': {'timestamp': 52914375.0}},
{'root': {'timestamp': 26457187.0}},
]
df = pd.DataFrame(data)
table = pa.Table.from_pandas(df, schema=schema)
pa.parquet.write_table(table, 'test_pyarrow_write_bug.parquet')
df_read = pd.read_parquet('test_pyarrow_write_bug.parquet')
assert df['root'].to_list() == df_read['root'].to_list()
```
<img width="895" alt="image"
src="https://github.com/apache/arrow/assets/21102313/4516e684-b686-442b-9e94-7f1d1dd8bf64">
I would expect the written and read files
### Component(s)
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]