Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyarrow casting error when saving/writing parquet file generated by sliderule #384

Closed
elidwa opened this issue Apr 5, 2024 · 0 comments
Closed

Comments

@elidwa
Copy link
Contributor

elidwa commented Apr 5, 2024

import pyarrow.parquet as pq

in_file = "atl06.parquet"
out_file = "atl06modified.parquet"

table = pq.read_table(in_file)
...
pq.write_table(table, 'out_file')

Writing the table generates an error:

pyarrow.lib.ArrowInvalid: Casting from timestamp[ns] to timestamp[us] would lose data: 1552556446894008576

Setting use_deprecated_int96_timestamps is a workaround.

pq.write_table(table, 'out_file', use_deprecated_int96_timestamps=True)

From docs:

Setting use_deprecated_int96_timestamps=True when writing the Parquet file tells PyArrow to store timestamp data
using the INT96 data type, which can represent nanosecond precision and is often used for compatibility with Apache Spark.

We need ns precision for time. Not sure if this can be fixed in the table itself. Documenting it for now.

@jpswinski jpswinski closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants