Skip to content
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

Trino queries cannot be stopped in SQL Lab #24858

Closed
3 tasks done
giftig opened this issue Aug 1, 2023 · 3 comments · May be fixed by trinodb/trino-python-client#400
Closed
3 tasks done

Trino queries cannot be stopped in SQL Lab #24858

giftig opened this issue Aug 1, 2023 · 3 comments · May be fixed by trinodb/trino-python-client#400

Comments

@giftig
Copy link
Contributor

giftig commented Aug 1, 2023

Trino queries do not get stopped in SQL Lab when hitting the STOP button.

How to reproduce the bug

  1. Configure a trino backend
  2. Run a query against trino, ideally one which takes a few minutes to execute
  3. Hit stop
  4. See the query continue to run (observe logs or check trino interface)

Expected results

Query should be stopped after hitting the stop button.

Actual results

It continues to run until completion

Environment

(please complete the following information):

  • browser type and version: N/A
  • superset version: 2.1
  • python version: N/A
  • node.js version: N/A
  • any feature flags active:
  • trino==0.324.0 but applies to other versions too

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

We've done some additional investigating into why this happens and we're ready to raise a draft PR which I'll attach to this issue. The bottom line is that the trino client doesn't have an async mode, and the query execution call will simply block until the query completes. This means the handle_cursor call we do is useless because we only extract query ID and/or trigger early cancellation events on the query after it's finished, when it's too late.

As a draft fix I've fired the query off in another thread manually and polled for the query ID to be appear asynchronously, and the rest of the stop query code seems to work fine with that in place. See PR.

@giftig
Copy link
Contributor Author

giftig commented Aug 1, 2023

PR, currently a draft as I need to check / add new unit tests: #24859 but feedback on the approach is appreciated.

@dungdm93
Copy link
Contributor

dungdm93 commented Aug 3, 2023

@rusackas
Copy link
Member

rusackas commented Mar 6, 2024

@giftig should this have been closed by your merged PR?

@giftig giftig closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants