FrancescoCastaldi commented on code in PR #43565:
URL: https://github.com/apache/superset/pull/43565#discussion_r3922368821


##########
superset/sql/parse.py:
##########
@@ -732,6 +732,60 @@ def __str__(self) -> str:
         return self.format()
 
 
+def _find_last_token_node(node: exp.Expression) -> exp.Expression:
+    """
+    Find the last token/leaf node in SQL generation order to attach trailing 
comments.
+
+    Avoids optimizer hints (exp.Hint) and non-trailing subtrees to prevent 
injecting
+    trailing comments inside optimizer hint blocks (e.g. /*+ SET_VAR(...) */).
+    """
+    if isinstance(node, exp.Select):
+        for clause_name in (
+            "options",
+            "settings",
+            "format",
+            "locks",
+            "offset",
+            "limit",
+            "sort",
+            "cluster",
+            "distribute",
+            "order",
+            "window",

Review Comment:
   Confirmed fixed, \_SELECT_TRAILING_CLAUSES\ in \superset/sql/parse.py\ uses 
\\windows\\ matching the SQLGlot \Select\ AST definition.



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

Reply via email to