Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7028

[R] Date roundtrip results in different R storage mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.15.0
    • 1.0.0
    • R

    Description

      When saving R-dataframes with parquet and loading them again, the internal representation of Dates changes, leading e.g. to errors when comparing them in dplyr::if_else.

      library(dplyr)
      #> 
      #> Attaching package: 'dplyr'
      #> The following objects are masked from 'package:stats':
      #> 
      #> filter, lag
      #> The following objects are masked from 'package:base':
      #> 
      #> intersect, setdiff, setequal, union
      
      tmp = tempdir()
      dat = tibble(tag = as.Date("2018-01-01"))
      dat2 = tibble(tag2 = as.Date("2019-01-01"))
      
      arrow::write_parquet(dat, file.path(tmp, "dat.parquet"))
      dat = arrow::read_parquet(file.path(tmp, "dat.parquet"))
      
      typeof(dat$tag)
      #> [1] "integer"
      typeof(dat2$tag2)
      #> [1] "double"
      
      bind_cols(dat, dat2) %>%
       mutate(comparison = if_else(TRUE, tag, tag2))
      #> `false` must be a `Date` object, not a `Date` object
      

      Created on 2019-10-30 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)

      Attachments

        Issue Links

          Activity

            People

              romainfrancois Romain Francois
              Daab Sascha
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h