[
https://issues.apache.org/jira/browse/ARROW-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257833#comment-16257833
]
ASF GitHub Bot commented on ARROW-1773:
---------------------------------------
wesm commented on issue #1310: ARROW-1773: [C++] Add casts from date/time types
to compatible signed integers
URL: https://github.com/apache/arrow/pull/1310#issuecomment-345405830
Casts from timestamp to int64 aren't implemented, so let me add these
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [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
> Assignee: Licht Takeuchi
> Labels: pull-request-available
>
> 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)