we integrate our analytics platform with Dremio through JDBC.
Users can issue a wrongly designed report. Corresponding SQL query can run too long.
We want to cancel such SQL queries running too long to not allow users to overload Dremio.
We would like to do it through JDBC preferably, but we can utilize REST API too, if it is the only way how to do it.
If it is not yet supported, please, let me know, if you plan to support it.
This is an example of how this use case is solved in PostgreSQL:
If I issue a query in Dremio, which collects data from underlying RDBMS, e.g. PostgreSQL, and I cancel it, is the query running in RDBMS also canceled?
In JDBC you can call Statement.cancel() to terminate a long running job from a separate thread. However you cannot use JDBC to cancel a Job created elsewhere.
You can use the REST API to cancel Jobs. It’s actually available in the UI under the Jobs page.
Both of these methods should cancel the operation on the backend database if it is still running.
@jduong Thanks for the response.
Regarding JDBC - if you cannot cancel Job created elsewhere, what Statement.cancel() do in separate thread, if the statement is running in different thread?
Regarding REST API - I know that it is in the UI, but can you point me to a DOC describing how it can be triggered through REST API programatically (or write it here, if it is not in a DOC)?
You can cancel a Statement that’s running in the same JDBC session you created in, provided you have access to the Statement object. That cancellation must happen in a separate thread because the thread running the execute call is blocking.
The REST API to cancel jobs is this: