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

[R][C++] Discussion: Plans for date casting from int to support an origin option?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • C++, R
    • None

    Description

      2 questions:

      • plans to support an origin option for int -> date32 casting?
      • plans to support double -> date32 casting?
        =======================
        Currently the casting from integer to date works, but assumes epoch (1970-01-01) as the origin. 
        > a <- Array$create(32L)
        > a$cast(date32())
        Array
        <date32[day]>
        [
          1970-02-02
        ]
        

      Would it make sense to have an origin option that would allow the user to fine tune the casting? For example, in R the base::as.Date() function has such an argument

      > as.Date(32, origin = "1970-01-02")
      [1] "1970-02-03"
      

      We have a potential workaround in R (once we support date & duration arithmetic), but I was wondering if there might me more general interest for this.

      A secondary aspect (as my R example shows) R support casting to date not only from integers, but also doubles. Would there be interesting in that? Need be I can split this into several tickets.

      Are there any plans in either of these 2 directions?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dragosmg Dragoș Moldovan-Grünfeld
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: