dgreiss commented on issue #40109: URL: https://github.com/apache/arrow/issues/40109#issuecomment-1970347755
It looks like R maps `difftime` objects as an Arrow `DurationType`, but `DurationType` stores the values as an int64, and so the R values are being casted to integers. This is happening on the C++ side: https://github.com/apache/arrow/blob/909f6f90ebdbb2e16b223d768ee10c78e0b37bfb/cpp/src/arrow/type.h#L1811-L1817 One workaround would be to convert the values to numerics before creating the Array: ```r > delta <- as.difftime(c(0.000, 0.001, 0.002, 1, 1.5), units = "secs") > arrow::Array$create(as.numeric(delta)) Array <double> [ 0, 0.001, 0.002, 1, 1.5 ] ``` Maybe the r package could provide a warning about the casting of difftime to integers to the user. -- 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]
