eschutho commented on code in PR #22441:
URL: https://github.com/apache/superset/pull/22441#discussion_r1051159888
##########
superset/db_engine_specs/impala.py:
##########
@@ -63,3 +74,117 @@ def get_schema_names(cls, inspector: Inspector) ->
List[str]:
if not row[0].startswith("_")
]
return schemas
+
+ @classmethod
+ def has_implicit_cancel(cls) -> bool:
+ """
+ Return True if the live cursor handles the implicit cancelation of the
query,
+ False otherise.
+
+ :return: Whether the live cursor implicitly cancels the query
+ :see: handle_cursor
+ """
+
+ return True
+
+ @classmethod
+ def execute( # pylint: disable=unused-argument
+ cls,
+ cursor: Any,
+ query: str,
+ **kwargs: Any,
+ ) -> None: # pylint: disable=arguments-differ
+ # kwargs = {"async": async_}
+ try:
+ cursor.execute_async(query)
+ except Exception as ex:
+ raise cls.get_dbapi_mapped_exception(ex)
+
+ @classmethod
+ def handle_cursor(cls, cursor: Any, query: Query, session: Session) ->
None:
+ """Stop query and updates progress information"""
+
+ query_id = query.id
+ unfinished_states = (
+ "INITIALIZED_STATE",
+ "RUNNING_STATE",
+ )
+ # When the query status is pending, the stop operation is queried
+ # Refresh session so that the `query.status` and
`query.extra.get(is_stopped)`
+ # modified in stop_query in views / core.py is reflected here.
+ # stop query
+ if cls.is_cancel_query(cls, query, session, query_id):
Review Comment:
I'm not too familiar with impala, to be honest, but for the other databases,
we usually handle the cancel query functionality when the `cancel_query` method
is called. It looks like it would be more efficient to move this logic into
`cancel_query` in this db engine spec so that it is only run when we know that
a cancel query has been requested, instead of checking on each cursor
operation.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]