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

[R] Support converting POSIXlt type

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0
    • R

    Description

      f <- as.POSIXlt(Sys.time() + 1:5)
      Array$create(f)
      # Error in Array__from_vector(x, type) : 
      #   Unknown: List vector expecting elements vector of type double but got int32
      

      Issue #1: POSIXlt type is a struct, essentially. But because it is not a data.frame, we don't try to convert it to a struct. (We should probably convert named lists to structs and not list type in general.)

      If I trick the converter into thinking it is a data.frame, it will convert to struct successfully.

      class(f) <- c(class(f), "data.frame")
      Array$create(f)
      # StructArray
      # <struct<sec: double, min: int32, hour: int32, mday: int32, mon: int32, year: int32, wday: int32, yday: int32, isdst: int32, zone: string, gmtoff: int32>>
      # ...
      

      Issue #2: round trip won't work because the attributes that tell you that this struct is a POSIXlt type, what time zone it is, etc., are dropped. This would be helped by storing those attributes as custom_metadata on the Table. (We could also implement it as an extension type, but if it's just for going back and forth between R, would that have any benefit?)

      Attachments

        Issue Links

          Activity

            People

              npr Neal Richardson
              npr Neal Richardson
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 20m
                  20m