You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "traversc (via GitHub)" <gi...@apache.org> on 2026/10/02 22:36:04 UTC

[I] [R] Silent loss of data integrity for date-time and numeric attributes in write_parquet()/read_parquet() [arrow]

traversc opened a new issue, #51695:
URL: https://github.com/apache/arrow/issues/51695

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   Double-valued attributes, including date-times, do not round-trip through Arrow's R metadata. No warning is raised. (Tested on arrow 25.0.1, R 4.6.1, Linux.)
   
   ```r
   library(arrow)
   options(digits.secs = 6)
   
   df <- data.frame(x = 1:3)
   attr(df, "updated") <- as.POSIXct("2026-10-02 14:30:15.987654321", tz = "UTC")
   
   f <- tempfile(fileext = ".parquet")
   write_parquet(df, f)
   back <- read_parquet(f)
   
   attr(df, "updated")
   #> [1] "2026-10-02 14:30:15.987654 UTC"
   attr(back, "updated")
   #> [1] "2026-10-02 14:30:15.987653 UTC"
   identical(attr(back, "updated"), attr(df, "updated"))
   #> [1] FALSE
   ```
   
   ### Suggested fix
   
   Fortuitously, R already has an exact variant of the ASCII format, so the fix is simple and fully backwards compatible.
   
   Arrow uses `R_pstream_ascii_format` (`ascii = TRUE` in `base::serialize`). Instead use `R_pstream_asciihex_format` (`ascii = NA`).
   
   ```r
   out <- serialize(safe_r_metadata(x, on_save = TRUE), NULL, ascii = NA)
   ```
   
   The hex format means that doubles are written out in hex instead of decimal.
   
   Either way, the output still starts with `"A"` (arrow's check) and base `unserialize()` reads it fine, so the reader needs no change and previous versions work with the output.
   
   
   ### Component(s)
   
   R


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [R] Silent loss of data integrity for date-time and numeric attributes in write_parquet()/read_parquet() [arrow]

Posted by "james-finn-travers (via GitHub)" <gi...@apache.org>.
james-finn-travers commented on issue #51695:
URL: https://github.com/apache/arrow/issues/51695#issuecomment-5964010740

   Hello, I would like to take on this pr, could you please assign to me?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org