Skip to content

Instantly share code, notes, and snippets.

@amoeba
Created November 8, 2024 00:19
Show Gist options
  • Save amoeba/4017732fbeb78fbad910754387a87855 to your computer and use it in GitHub Desktop.
Save amoeba/4017732fbeb78fbad910754387a87855 to your computer and use it in GitHub Desktop.
tf <- tempfile()
table <- Table$create(
some_datetime = as.POSIXct("2001-01-01 12:34:56.789")
)
write_parquet(
table,
tf,
use_deprecated_int96_timestamps = TRUE
)
props <- ParquetArrowReaderProperties$create()
props$set_coerce_int96_timestamp_unit(TimeUnit$MILLI)
expect_identical(props$coerce_int96_timestamp_unit(), TimeUnit$MILLI)
result <- read_parquet(
tf,
as_data_frame = FALSE,
props = props
)
table$some_datetime
result$some_datetime
# for some reason this isn't `==.ArrowObject`. Why?
table$some_datetime == result$some_datetime
`==`(table$some_datetime, result$some_datetime) # same as above, as expected
table$some_datetime$Equals(result$some_datetime) # => FALSE
all.equal(table$some_datetime, result$some_datetime) # => FALSE
# cast and Equals works
table$some_datetime == result$some_datetime$cast(table$some_datetime$type)
table$some_datetime$Equals(result$some_datetime$cast(table$some_datetime$type))
result$some_datetime$Equals(table$some_datetime$cast(result$some_datetime$type))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment