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

[C++] Add casts from date/time types to compatible signed integers

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: None

      Description

      e.g.

      In [3]: arr = pa.array([1,2,3], type='i4')
      
      In [4]: arr.cast('date32')
      Out[4]: 
      <pyarrow.lib.Date32Array object at 0x7fc35f8b56d8>
      [
        datetime.date(1970, 1, 2),
        datetime.date(1970, 1, 3),
        datetime.date(1970, 1, 4)
      ]
      
      In [5]: arr.cast('date32').cast('i4')
      ---------------------------------------------------------------------------
      ArrowNotImplementedError                  Traceback (most recent call last)
      <ipython-input-5-7b6f6cf1cced> in <module>()
      ----> 1 arr.cast('date32').cast('i4')
      
      /home/wesm/code/arrow/python/pyarrow/array.pxi in pyarrow.lib.Array.cast (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:28923)()
          266 
          267         with nogil:
      --> 268             check_status(Cast(_context(), self.ap[0], type.sp_type,
          269                               options, &result))
          270 
      
      /home/wesm/code/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:8306)()
           83             raise ArrowKeyError(message)
           84         elif status.IsNotImplemented():
      ---> 85             raise ArrowNotImplementedError(message)
           86         elif status.IsTypeError():
           87             raise ArrowTypeError(message)
      
      ArrowNotImplementedError: /home/wesm/code/arrow/cpp/src/arrow/compute/cast.cc:920 code: GetCastFunction(*array.type(), out_type, options, &func)
      No cast implemented from date32[day] to int32
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Licht-T Licht Takeuchi
                Reporter:
                wesmckinn Wes McKinney
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: