-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unnecessary cancel requests #136
base: master
Are you sure you want to change the base?
Conversation
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
@cla-bot check |
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
The cla-bot has been summoned, and re-checked this pull request! |
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
@nineinchnick add a need unit test. I think it make sense |
Overview
This PR fixes unnecessary delete requests when the query is already finished.
Explanation
This change addresses Issue #102
QueryRow
followed by aScan
, the Trino driver first calls theNext
method and then the Close method. TheClose
method triggers a delete request to cancel the query, even when the query has already completed.nextUri
in theClose
method instead of directly calling/v1/query/queryId
, as suggested in the documentation and implemented by other drivers. However, to make this work, I needed to always updaterows.nextUri
inside thefetch
method, as it was previously retaining only the first URI set here. Despite these changes, the issue persisted.Next
method so that when all rows have been read, it fetches the next set of rows. This works because ourfetch
method, along with the running Goroutines, followsnextUri
until data is retrieved.QueryRow
, this ensures that when the query reaches the finished state with no more data, nextUri is cleared, preventing an unnecessary request on Close().QueryContext
, this is also fine because it fetches the next batch of data, ensuring that additional data (if available) is retrieved correctly.