-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Due to an upstream bug in nanoparquet (see r-lib/nanoparquet#140), the timezone argument of a POSIXct data type is ignored when using type = parquet in pins::write_pin. See a reprex below:
library(dplyr)
library(lubridate)
library(pins)
set.seed(123)
df <-
storms |>
dplyr::slice_sample(n = 1000) |>
dplyr::mutate(
name,
datetime = lubridate::make_datetime(year,month,day,hour,tz = "UTC"),
datetime_tz = lubridate::with_tz(datetime, "America/New_York"),
.keep = "none"
)
# Compare timezones
waldo::compare(
lubridate::tz(df$datetime),
lubridate::tz(df$datetime_tz)
)
#> `old`: "UTC"
#> `new`: "America/New_York"
# Save as a parquet pin
board <- pins::board_temp()
pins::pin_write(board, df, name = "test", type = "parquet")
#> Creating new version '20250619T004531Z-fb1d7'
#> Writing to pin 'test'
df_read <- pins::pin_read(board, "test")
# Should be "America/New_York"
lubridate::tz(df_read$datetime_tz)
#> [1] "UTC"
# Compare timezones
waldo::compare(
lubridate::tz(df_read$datetime),
lubridate::tz(df_read$datetime_tz)
)
#> ✔ No differencesCreated on 2025-06-19 with reprex v2.1.1
I am using nanoparquet_0.4.2 and pins_1.4.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels