paleolimbot opened a new pull request, #298:
URL: https://github.com/apache/arrow-nanoarrow/pull/298

   This lets a caller take appropriate action (or give an error, or give a 
better warning) if a lossy conversion occurs.
   
   ``` r
   library(nanoarrow)
   
   array <- as_nanoarrow_array(2^54, schema = na_int64())
   
   convert_array(array, double())
   #> Warning in convert_array.default(array, double()): 1 value(s) may have 
incurred
   #> loss of precision in conversion to double()
   #> [1] 1.80144e+16
   
   withCallingHandlers(
     convert_array(array, double()),
     nanoarrow_warning_lossy_conversion = function(x) {
       warning(
         "This is a better explanation of what happened!",
         call. = conditionCall(x)
       )
       tryInvokeRestart("muffleWarning")
     }
   )
   #> Warning in (function (x) : This is a better explanation of what happened!
   #> [1] 1.80144e+16
   ```
   
   <sup>Created on 2023-09-18 with [reprex 
v2.0.2](https://reprex.tidyverse.org)</sup>


-- 
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]

Reply via email to