aminghadersohi commented on code in PR #45283:
URL: https://github.com/apache/superset/pull/45283#discussion_r4278798021
##########
superset/sql/execution/celery_task.py:
##########
@@ -481,25 +570,60 @@ def _execute_sql_statements(
)
) from ex
- # Check if stopped
- if not execution_results:
- payload.update({"status": QueryStatus.STOPPED.value})
- return payload
+ # Cancelling can clear cursor.description, leaving a nonempty result
+ # list that looks like successful DML. Check intent, not just results.
+ stopped = not execution_results or check_stopped()
# Commit for mutations
- if parsed_script.has_mutation() or query.select_as_cta:
+ committed = False
+ if not stopped and (parsed_script.has_mutation() or
query.select_as_cta):
Review Comment:
Not fixed: an independent check at bb19cf7abf62d8519c2766648e05729ef1834da3
also reproduced a case my previous reply did not list. If the target commit
applies and then raises while a stop lands at the same time, the INSERT data is
durable but the row and payload report STOPPED, on both the Celery and legacy
paths. This PR does not fix it; it is tracked with the other follow-up items
listed above.
##########
superset/sql_lab.py:
##########
@@ -628,8 +651,12 @@ def execute_sql_statements( # noqa: C901
return payload
# Commit the connection so CTA queries will create the table and any
DML.
+ committed = False
if parsed_script.has_mutation() or query.select_as_cta:
Review Comment:
Not fixed: an independent check at bb19cf7abf62d8519c2766648e05729ef1834da3
also reproduced a case my previous reply did not list. If the target commit
applies and then raises while a stop lands at the same time, the INSERT data is
durable but the row and payload report STOPPED, on both the Celery and legacy
paths. This PR does not fix it; it is tracked with the other follow-up items
listed above.
##########
superset/sql_lab.py:
##########
@@ -825,7 +867,9 @@ def execute_sql_statements( # noqa: C901
# unit-test suite driving this fix never exercised.
db.session.flush()
db.session.refresh(query)
- if query.status not in (QueryStatus.FAILED, QueryStatus.STOPPED):
+ if query.status != QueryStatus.FAILED and (
+ committed or query.status != QueryStatus.STOPPED
+ ):
query.status = QueryStatus.SUCCESS
Review Comment:
Not fixed: an independent check at bb19cf7abf62d8519c2766648e05729ef1834da3
also reproduced a case my previous reply did not list. If a stop lands during
the post-publish Arrow-to-inline conversion or the return-payload size
serialization, the row ends STOPPED while the response returns SUCCESS data; in
the stored-results variants the referenced blob is kept. This PR does not fix
it; it is tracked as a follow-up.
--
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]