wanghong1314 commented on issue #20950:
URL: https://github.com/apache/superset/issues/20950#issuecomment-1294663198
I have resolve method ,The following code in
superset/db_engine_specs/impala.py
@staticmethod
def execute( # type: ignore
cursor, query: str, async_: bool = False
): # pylint: disable=arguments-differ
# kwargs = {"async": async_}
cursor.execute_async(query)
@classmethod
def handle_cursor(cls, cursor: Any, query: Query, session: Session) ->
None:
"""Handle a live cursor between the execute and fetchall calls
The flow works without this method doing anything, but it allows
for handling the cursor and updating progress information in the
query object"""
# TODO: Fix circular import error caused by importing sql_lab.Query
query_id = query.id
session.refresh(query, ['status'])
query = session.query(type(query)).filter_by(id=query_id).one()
unfinished_states = (
'INITIALIZED_STATE',
'RUNNING_STATE',
)
polled = cursor.status()
query_id = query.id
if query.status == QueryStatus.STOPPED:
logger.info("query_id_cancel=" + str(query_id))
try:
cursor.cancel_operation()
cursor.close_operation()
cursor.close()
except Exception as ex:
print("出现如下异常%s" % ex)
while polled in unfinished_states:
query = session.query(Query).filter_by(id=query_id).one()
session.refresh(query, ['status'])
is_stopped = query.extra.get('is_stopped')
if query.status == QueryStatus.STOPPED or is_stopped:
logger.info("while polled query_id_cancel=" + str(query_id))
try:
cursor.cancel_operation()
cursor.close_operation()
cursor.close()
except Exception as ex:
print("exception %s" % ex)
break
logs = cursor.get_log()
logger.info("logs=" + logs)
if logs:
progress = cls.progress(logs)
logger.info(
"Query %s: Progress total: %s", str(query_id),
str(progress)
)
needs_commit = False
if progress > query.progress:
query.progress = progress
needs_commit = True
if needs_commit:
session.commit()
time.sleep(current_app.config["IMPALA_POLL_INTERVAL"])
polled = cursor.status()

--
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]