Skip to content

Conversation

Flgado
Copy link
Member

@Flgado Flgado commented Aug 15, 2025

PR Summary

This PR proposes a potential fix for issue #102

Proposed Solution

Before calling the delete query endpoint, we first validate whether the query has already finished on the Trino side by calling v1/query/:queryId. This endpoint returns the query status, and if it returns FINISHED, we skip the delete request.

Currently, this validation is applied only when rowIndex = 1 to limit the scope of changes. We can discuss whether it would make sense to always validate the query status before deleting.

Discussion Points

Should we validate the status for all cases, not just when rowIndex = 1?

Should we check for both FINISHED and FINISHING states? According to the documentation, FINISHING indicates that the query has finished executing and all output has been consumed. It may still make sense to call delete for FINISHING queries since they are still consuming resources.
Any idea for integration tests ? Getting the query state while the QueryRow is being run and make sure that the state is never USER_CANCEL ?

@cla-bot cla-bot bot added the cla-signed label Aug 15, 2025
@Flgado Flgado requested a review from nineinchnick August 15, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant