Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
asfimport opened this issue Nov 6, 2017 · 1 comment
Closed

Comments

@asfimport
Copy link

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

Reporter: Wes McKinney / @wesm
Assignee: Licht Takeuchi / @Licht-T

PRs and other links:

Note: This issue was originally created as ARROW-1773. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Issue resolved by pull request 1310
#1310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant