thisisnic commented on issue #47336:
URL: https://github.com/apache/arrow/issues/47336#issuecomment-7149005980
I used an AI agent to rerun this on current releases and compare it with
#45062, and I've reviewed the results.
----------------
🤖 :
This still happens on pyarrow 26.0.1 (Linux x86_64):
```python
import base64, datetime
import pyarrow as pa
import pyarrow.parquet as pq
t = pa.table({"ts": pa.array([datetime.datetime(2025, 1, 1, 12)],
pa.timestamp("ns"))})
pq.write_table(t, "c.parquet", coerce_timestamps="ms")
pf = pq.ParquetFile("c.parquet")
print(pf.schema.column(0).logical_type) # timeUnit=milliseconds
raw = pf.metadata.metadata[b"ARROW:schema"]
print(pa.ipc.read_schema(pa.BufferReader(base64.b64decode(raw))).field("ts").type)
# timestamp[ns]
```
The writer builds the Parquet schema with the coercion applied, but
serialises the original schema into `ARROW:schema` (`GetSchemaMetadata(schema,
...)` in `FileWriter::Open`, `cpp/src/parquet/arrow/writer.cc`).
Polars 2.2.0 reads this file as `Datetime(time_unit='ms')`, so the mismatch
no longer shows up there, but the two schemas in the file still disagree.
As agreed above this is the same problem as #45062, which is the older
report, so closing this one as a duplicate.
--
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]