paleolimbot commented on PR #985:
URL: https://github.com/apache/arrow-adbc/pull/985#issuecomment-2106071624

   I'll play with this a bit more and try to get this down to a minimum viable 
feature that one or both of us can build on.
   
   > Regarding polling: How does mirai do it? 
   
   It looks like this happens mostly in nanonext through a runtime dependency 
on later's C export:
   
   
https://github.com/shikokuchuo/nanonext/blob/b139a84512140ac5643f8f3ecb76a6ce8221c531/src/aio.c#L1292
   
   ...which is perhaps a lower-level version of just vendoring the later 
function definition: 
https://github.com/r-lib/later/blob/968542a0b42fa191e6a5a57f180a6af345083bf5/inst/include/later.h#L50
   
   I can play with this a little but off the top of my head, I think here one 
could pass an optional R callback when the async method is launched, which 
would invoke the runtime "later" dependency (this would replace the ugly 
later-scheduling itself thing I have here). If there's no callback, one can 
still poll the `adbc_async_task`.
   
   > Regarding chaining: Can we chain promises or futures in C++?
   
   As long as we know ahead of time what has to happen and it can all happen on 
another thread, I think we can just define an async launcher that does it all 
and wait for it to finish. In this case, it would be 
`AdbcStatementExecuteQuery` + `ArrowArrayStream::get_schema()` + a bunch of 
`ArrowArrayStream::get_next()`. If we really need the flexibility to compose 
things, R-level promise things should work.
   
   > move the async logic to a package that doesn't mind that dependency.
   
   With the runtime loading of the later C callable I think we can do this 
here, although ADBC is quite nice for this because we could in theory document 
how to get/call the methods (all of this is ABI stable!).


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