Query cancellation with CTRL-C for R client#3747
Conversation
|
CC @krlmlr |
krlmlr
left a comment
There was a problem hiding this comment.
What are the semantics of pending_query->ExecuteTask() ?
See #2797 //! Executes a single task within the query, returning whether or not the query is ready.
//! If this returns RESULT_READY, the Execute function can be called to obtain a pointer to the result.
//! If this returns RESULT_NOT_READY, the ExecuteTask function should be called again.
//! If this returns EXECUTION_ERROR, an error occurred during execution.
//! The error message can be obtained by calling GetError() on the PendingQueryResult.
PendingExecutionResult ExecuteTask();
|
|
Are there plans to bring this to the C API? I hate to be greedy, but I have wished for such a thing for interactive UI's that allow the users to get themselves into trouble with sliders and such. I suspect my C skills are not going to pass muster for a PR. Would you expect the signatures to be something like this: duckdb_state duckdb_query_pending_init(duckdb_connection connection, const char *query, duckdb_pending_query *out) {
}
duckdb_state duckdb_query_pending_execute(duckdb_pending_query *pending, duckdb_result *out) {
}
duckdb_state duckdb_query_pending_cancel(duckdb_pending_query *pending) {
} |
I agree this would be a useful extension to the C API - I can have a go at adding this. |
|
That would be fantastic! |
Even though DuckDB is very fast, sometimes a query does run for a long time and sometimes the user does not wish to wait for its completion. With this change, we use the pending query API #2797 to call
R_CheckUserInterruptevery now and then. If an interrupt has occurred, query execution will abort. For example,can now just be aborted by pressing CTRL-C