You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (JIRA)" <ji...@apache.org> on 2017/11/06 21:09:00 UTC

[jira] [Created] (ARROW-1773) [C++] Add casts from date/time types to compatible signed integers

Wes McKinney created ARROW-1773:
-----------------------------------

             Summary: [C++] Add casts from date/time types to compatible signed integers
                 Key: ARROW-1773
                 URL: https://issues.apache.org/jira/browse/ARROW-1773
             Project: Apache Arrow
          Issue Type: New Feature
            Reporter: Wes McKinney


e.g.

{code}
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
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)