codeant-ai-for-open-source[bot] commented on code in PR #45283:
URL: https://github.com/apache/superset/pull/45283#discussion_r4276426033
##########
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:
**Suggestion:** On Impala, Hive, and Trino, mutations are already durable
when execution returns; a stop observed here exits before marking `committed`,
so the task reports STOPPED despite applied changes.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Incorrect condition
logic`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cf3b0e02afd54fdc863d07859d99f9bc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cf3b0e02afd54fdc863d07859d99f9bc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/sql/execution/celery_task.py
**Line:** 575:579
**Comment:**
*Incorrect Condition Logic: On Impala, Hive, and Trino, mutations are
already durable when execution returns; a stop observed here exits before
marking `committed`, so the task reports STOPPED despite applied changes.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45283&comment_hash=c3ab7c7d6f8268b7d64bdc02bc01a026dd071a6efe0a5c10ca490dbc0c387b03&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45283&comment_hash=c3ab7c7d6f8268b7d64bdc02bc01a026dd071a6efe0a5c10ca490dbc0c387b03&reaction=dislike'>๐</a>
##########
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:
**Suggestion:** If a stop arrives during SELECT finalization, this preserves
STOPPED in the database but leaves the already-built payload marked SUCCESS, so
SQL Lab exposes contradictory states.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f86989e7c4fb43f6b2642c00511d6f15&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f86989e7c4fb43f6b2642c00511d6f15&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/sql_lab.py
**Line:** 870:873
**Comment:**
*Api Mismatch: If a stop arrives during SELECT finalization, this
preserves STOPPED in the database but leaves the already-built payload marked
SUCCESS, so SQL Lab exposes contradictory states.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45283&comment_hash=a70e44fd39b708e620f534fdea4b6591ea1395567026aa3c8a61c5a154ce3ac7&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45283&comment_hash=a70e44fd39b708e620f534fdea4b6591ea1395567026aa3c8a61c5a154ce3ac7&reaction=dislike'>๐</a>
--
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]