bito-code-review[bot] commented on PR #43565:
URL: https://github.com/apache/superset/pull/43565#issuecomment-5431670710
<!-- Bito Reply -->
The flagged issue is correct. The current implementation of
`_find_last_token_node` in `superset/sql/parse.py` uses the argument name
`window` for `exp.Select`, but SQLGlot's `Select` AST uses `windows` (plural).
Consequently, queries with `WINDOW` clauses are not correctly identified as the
final clause, causing trailing comments to be attached to the wrong node.
To resolve this, update the `clause_name` tuple in `_find_last_token_node`
to use `windows` instead of `window`:
```python
# superset/sql/parse.py
for clause_name in (
"options",
"settings",
"format",
"locks",
"offset",
"limit",
"sort",
"cluster",
"distribute",
"order",
"windows", # Updated from "window"
"qualify",
"having",
"group",
"where",
"joins",
"laterals",
"from",
"into",
"expressions",
):
```
There are no other review comments on this PR.
**superset/sql/parse.py**
```
for clause_name in (
"options",
"settings",
"format",
"locks",
"offset",
"limit",
"sort",
"cluster",
"distribute",
"order",
"windows", # Updated from "window"
"qualify",
"having",
"group",
"where",
"joins",
"laterals",
"from",
"into",
"expressions",
):
```
--
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]