You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "wugeer (via GitHub)" <gi...@apache.org> on 2024/09/27 02:35:19 UTC
[PR] feat: cancel impala query on stop [superset]
wugeer opened a new pull request, #30412:
URL: https://github.com/apache/superset/pull/30412
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
feat: cancel sqllab impala query on stop
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Currently, when executing an Impala query in SQL Lab, clicking the cancel button only cancels the query in Superset, but the query is not canceled on the Impala side, and the resources are not released.
This commit resolves the issue by ensuring that when an Impala query is canceled in SQL Lab, the query is also canceled on the Impala side, achieving the goal of releasing resources.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
before
[impala_sql_lab_cancel_before.webm](https://github.com/user-attachments/assets/05750ebd-023b-4a2f-a6b6-652d2e082770)
after
[impala_cancel_query.webm](https://github.com/user-attachments/assets/80cdb661-1daa-47c7-9a00-aa4c8a43735e)
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [x] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: cancel impala query on stop [superset]
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #30412:
URL: https://github.com/apache/superset/pull/30412
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: cancel impala query on stop [superset]
Posted by "wugeer (via GitHub)" <gi...@apache.org>.
wugeer commented on PR #30412:
URL: https://github.com/apache/superset/pull/30412#issuecomment-2440285359
> Looking good, however, in the interest of legibility, I would prefer a slightly more explicit name for the new property.
@villebro have Done! :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: cancel impala query on stop [superset]
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #30412:
URL: https://github.com/apache/superset/pull/30412#discussion_r1778848214
##########
superset/config.py:
##########
@@ -1510,6 +1510,14 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument
"postgresql": "PostgreSQLValidator",
}
+# A list of database dialects which the query ID is not related to the connection.
+# The database dialects set here will update the `cancel_query` value
+# in the `extra` field of the `query` object after executing the corresponding SQL and
+# before retrieving the result set
+QUERY_ID_NOT_ASSOCIATED_CONNECT: list[str] = [
+ "impala",
+]
Review Comment:
Is there a reason this is put in `config.py`? The typical solution would be to add a new class property in `BaseEngineSpec` that's disabled by default, but is then set to true on the specific spec (in this case `ImpalaEngineSpec`). But please correct me if I'm misunderstanding something here..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: cancel impala query on stop [superset]
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #30412:
URL: https://github.com/apache/superset/pull/30412#discussion_r1817149817
##########
superset/db_engine_specs/base.py:
##########
@@ -437,6 +437,14 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
# Driver-specific exception that should be mapped to OAuth2RedirectError
oauth2_exception = OAuth2RedirectError
+ # Does the query id related to the connection?
+ # The default value is True, which means that the query id is determined when
+ # the connection is created.
+ # When this is changed to false in a DB engine spec it means the query id
+ # is determined only after the specific query is executed and it will update
+ # the `cancel_query` value in the `extra` field of the `query` object
+ is_query_id_associated_connect = True
Review Comment:
I like the comment, however, I find the property name difficult to understand. Could we rename this to something more descriptive, like `has_query_id_before_execute` or something similar.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: cancel impala query on stop [superset]
Posted by "wugeer (via GitHub)" <gi...@apache.org>.
wugeer commented on PR #30412:
URL: https://github.com/apache/superset/pull/30412#issuecomment-2437104739
@villebro Could you please take some time to review my code? Thanks a lot!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org