You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Not able to read nano-second timestamp columns in 1.0 parquet files written by pyarrow #455
When storing this dataframe into parquet 1.0 format, pyarrow stores the Date column in microsecond unit. pyarrow is able to load the Date column with microsecond precision as well:
I'd have expected the ns timestamp to be written to int96 as that is the legacy nanosecond timestamp format. I'll also dig into this to see, maybe if the format is 1.0 then we should coerce the timestamp to a different resolution, but I'd also see this as a pyarrow quirk that could be documented somewhere.
@emkornfield do you know what we should do on the Rust side to roundtrip the file correctly?
pyarrow parquet writer has an option that one can set to write ns timestamp as int96 for parquet 1.0, but is turned off by default. It is quite strange that decoded IPC schema comes back a ns type even though it's stored as ms.
@emkornfield do you know what we should do on the Rust side to roundtrip the file correctly?
Sorry, I would have to dig in the code to have a better understanding. In general we try to avoid int96 because it is a deprecated type. If this is an issue with pyarrow can we open a separate bug to track that?
This may be related to which priority we give when converting, the parquet schema or the arrow schema. I would expect pyarrow to write them in a consistent manner though, so, as @nevi-me mentioned, an arrow schema in ns with a parquet schema in ms does seem odd.
Here is C++ attempts to reuse original metadata. It doesn't look like we would use the arrow schema in this case. I'm guessing conversion back the Pandas type happens correctly because microseconds would be cast back at the arrow to pandas layer.
So I think there is probably a bug in pyarrow here since we wouldn't round trip a pure timestamp[ns] type, but we don't run into it in from pandas because the casting just works.
Activity
nevi-me commentedon Jun 14, 2021
I'd have expected the ns timestamp to be written to
int96as that is the legacy nanosecond timestamp format. I'll also dig into this to see, maybe if the format is1.0then we should coerce the timestamp to a different resolution, but I'd also see this as a pyarrow quirk that could be documented somewhere.@emkornfield do you know what we should do on the Rust side to roundtrip the file correctly?
houqp commentedon Jun 14, 2021
pyarrow parquet writer has an option that one can set to write ns timestamp as
int96for parquet 1.0, but is turned off by default. It is quite strange that decoded IPC schema comes back anstype even though it's stored asms.emkornfield commentedon Jun 15, 2021
Sorry, I would have to dig in the code to have a better understanding. In general we try to avoid int96 because it is a deprecated type. If this is an issue with pyarrow can we open a separate bug to track that?
jorgecarleitao commentedon Jun 15, 2021
This may be related to which priority we give when converting, the parquet schema or the arrow schema. I would expect pyarrow to write them in a consistent manner though, so, as @nevi-me mentioned, an arrow schema in ns with a parquet schema in ms does seem odd.
emkornfield commentedon Jun 16, 2021
https://github.com/apache/arrow/blob/8e43f23dcc6a9e630516228f110c48b64d13cec6/cpp/src/parquet/arrow/schema.cc#L215 is probably the relevant writing code for 1.0 so that might explain the discrepancy, let me see If I can dig up the reader code.
emkornfield commentedon Jun 16, 2021
Here is C++ attempts to reuse original metadata. It doesn't look like we would use the arrow schema in this case. I'm guessing conversion back the Pandas type happens correctly because microseconds would be cast back at the arrow to pandas layer.
emkornfield commentedon Jun 16, 2021
So I think there is probably a bug in pyarrow here since we wouldn't round trip a pure timestamp[ns] type, but we don't run into it in from pandas because the casting just works.
tustvold commentedon Oct 21, 2022
I believe this is a duplicate of #1459 which was fixed by #1682. Please feel free to reopen if I am mistaken