paleolimbot commented on issue #1008:
URL: https://github.com/apache/arrow-adbc/issues/1008#issuecomment-1701688888

   I think it seems reasonable that a driver R package should have the 
opportunity to have some control over how a given `data.frame()` is converted 
to a `nanoarrow_array_stream`. Right now that call is just 
`nanoarrow::as_nanoarrow_array_stream()`, which doesn't leave any room for - as 
you noted - the database driver to negotiate types it does not support but 
could (either losslessly - like storing a logical as an integer - or by 
stripping some metadata with a warning - like for difftime).
   
   Perhaps:
   
   ```r
   as_adbc_bind_array_stream <- function(x) {
     UseMethod("as_adbc_bind_array_stream")
   }
   
   as_adbc_bind_array_stream.default <- function(x) {
     nanoarrow::as_nanoarrow_array_stream(x)
   }
   ```
   
   The SQLite driver could then do:
   
   ```r
   as_adbc_bind_array_stream.adbcsqlite_statement <- function(x) {
     if (is.data.frame(x)) {
       # loop and reassign columns with unsupported types, possibly warning for
       # assignments that will loose information
     }
   
     nanoarrow::as_nanoarrow_array_stream(x)
   }
   ```


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