It's possible to cast doubles to durations, but not integers. This has been found in the R code via the issues below:
The shortest reprex I can make is as follows:
# Successfully cast a double to a duration
vec_to_Array(as.difftime(32, units="secs"), NULL)$cast(duration())
#> Array#> <duration[s]>#> [#> 32#> ]# Fail to do so with an integer
vec_to_Array(as.difftime(32L, units="secs"), NULL)$cast(duration())
#> Error: NotImplemented: Unsupported cast from int32 to duration using function cast_duration
I would expect both a and b to create a duration object of 32 seconds, but the second one returns an int32
library(arrow, warn.conflicts=FALSE)
a<- as.difftime(32, units="secs") # i.e. a doubleb<- as.difftime(32L, units="secs") # i.e. an integerArray$create(a)
#> Array#> <duration[s]>#> [#> 32#> ]Array$create(b)
#> Array#> <int32>#> [#> 32#> ]
If I try to be explicit, I get somewhat of a clue why that might be happening:
Array$create(a, type= duration())
#> Array#> <duration[s]>#> [#> 32#> ]Array$create(b, type= duration())
#> Error:#> ! NotImplemented: Extend
Nevertheless, the fallback to creating an integer was unexpected.
Reporter: Dragoș Moldovan-Grünfeld / @dragosmg
Related issues:
Note: This issue was originally created as ARROW-15858. Please see the migration documentation for further details.
It's possible to cast doubles to durations, but not integers. This has been found in the R code via the issues below:
The shortest reprex I can make is as follows:
I would expect both
aandbto create adurationobject of 32 seconds, but the second one returns anint32If I try to be explicit, I get somewhat of a clue why that might be happening:
Nevertheless, the fallback to creating an integer was unexpected.
Reporter: Dragoș Moldovan-Grünfeld / @dragosmg
Related issues:
Note: This issue was originally created as ARROW-15858. Please see the migration documentation for further details.