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

[R] Timezone support in R <= 3.4

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 6.0.0
    • R

    Description

      The error is: https://github.com/ursacomputing/crossbow/runs/3696604088#step:7:15209

       Timezone not present, cannot convert to string with timezone: %Y-%m-%d%z
      

      Ok, I think I’ve got close to the source of the issue (though let me tell you neither the source nor the docs for R are accurate [1] on this…)

      3.4 (and earlier):

      > attributes(c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Etc/GMT+6"), NA)) 
      $class
      [1] "POSIXct" "POSIXt" 
      

      3.5 (and later):

      > attributes(c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Etc/GMT+6"), NA)) 
      $class
      [1] "POSIXct" "POSIXt" 
      
      $tzone
      [1] "Etc/GMT+6"
      

      So R itself is dropping the tzone attribute when we use c(), that is being passed to Arrow as such, and then when Arrow goes to print a timezone it (rightfully!) complains that there is no timezone to be formatted into the string.

      This behavior actually sounds right (given the inputs), so I propose that we catch the error R <=3.4 (or skip the test in r<=3.4)

      [1] - The documented behavior is current, but it didn't change at the same time as the actual behavior.

      The docs starting in 4.1.0 state:
      Using \code{\link{c}} on \code

      {"POSIXlt"} objects converts them to the
      current time zone, and on \code{"POSIXct"} objects drops any
      \code{"tzone"} attributes, unless they are all marked with the same
      time zone.
      https://github.com/wch/r-source/blob/tags/R-4-1-0/src/library/base/man/DateTimeClasses.Rd#L180-L183

      The docs before that state:
      Using \code{\link{c}} on \code{"POSIXlt"}

      objects converts them to the
      current time zone, and on \code

      {"POSIXct"}

      objects drops any
      \code

      {"tzone"}

      attributes (even if they are all marked with the same
      time zone).
      https://github.com/wch/r-source/blob/tags/R-4-0-5/src/library/base/man/DateTimeClasses.Rd

      Attachments

        Issue Links

          Activity

            People

              jonkeane Jonathan Keane
              jonkeane Jonathan Keane
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 1h 40m
                  1h 40m