cgiachalis opened a new issue, #811:
URL: https://github.com/apache/arrow-nanoarrow/issues/811
Converting an int64 to timestamp type is not working via
`as_nanoarrow_array` method:
```r
as_nanoarrow_array(bit64::as.integer64(1), schema = na_timestamp("ns"))
# Error: Invalid: Invalid conversion to timestamp
```
It works doing it *"manually"*:
``` r
x <- bit64::as.integer64(nanotime::as.nanotime(Sys.time()))
schema <- as_nanoarrow_schema(na_timestamp("ns"))
array <- nanoarrow_array_init(schema)
array <- nanoarrow_array_modify(array, list(length = length(x),
null_count = 0,
buffers = list(NULL, x)))
array
#> <nanoarrow_array timestamp('ns', '')[1]>
#> Warning in convert_array.default(array): 1 value(s) may have incurred
loss of
#> precision in conversion to double()
#> $ length : int 1
#> $ null_count: int 0
#> $ offset : int 0
#> $ buffers :List of 2
#> ..$ :<nanoarrow_buffer validity<bool>[null] ``
#> ..$ :<nanoarrow_buffer data<int64>[1][8 b]> `1.76e+18`
#> $ dictionary: NULL
#> $ children : list()
```
NB: Printing the `array` object comes with a warning about potential loss
of precision in conversion to `double()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]