Dragoș Moldovan-Grünfeld created ARROW-15996:
------------------------------------------------
Summary: [C++] Support casting from time32 and time64 to duration
Key: ARROW-15996
URL: https://issues.apache.org/jira/browse/ARROW-15996
Project: Apache Arrow
Issue Type: Improvement
Components: C++
Reporter: Dragoș Moldovan-Grünfeld
It would be really helpful if we could convert {{time32}} and {{time64}} to
{{duration}}. For example, it could simplify the implementation of some of the
R bindings (e.g. {{difftime}}).
{code:r}
library(arrow, warn.conflicts = FALSE)
a <- Array$create(32000L)
a
#> Array
#> <int32>
#> [
#> 32000
#> ]
a$cast(time32())
#> Array
#> <time32[ms]>
#> [
#> 00:00:32.000
#> ]
a$cast(int64())$cast(time64())
#> Array
#> <time64[ns]>
#> [
#> 00:00:00.000032000
#> ]
a$cast(time32())$cast(duration())
#> Error: NotImplemented: Unsupported cast from time32[ms] to duration using
function cast_duration
a$cast(int64())$cast(time64())$cast(duration())
#> Error: NotImplemented: Unsupported cast from time64[ns] to duration using
function cast_duration
{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)