bito-code-review[bot] commented on PR #41125:
URL: https://github.com/apache/superset/pull/41125#issuecomment-4725090362

   <!-- Bito Reply -->
   The flagged issue is correct. Returning the raw clause verbatim for 
comment-free inputs preserves trailing semicolons, which causes invalid SQL 
when the clause is embedded into larger fragments like `WHERE (...)` or `HAVING 
(...)` by downstream callers.
   
   To resolve this, you should strip trailing semicolons from the `clause` 
before returning it in the `sanitize_clause` function when no comments are 
present. You can achieve this by modifying the return statement in 
`superset/sql/parse.py` as follows:
   
   ```python
           if not any(node.comments for node in parsed.walk()):
               return clause.rstrip('; ')
   ```
   
   This ensures that trailing semicolons (and any trailing whitespace) are 
removed while still preserving the original formatting of the expression itself.
   
   **superset/sql/parse.py**
   ```
   if not any(node.comments for node in parsed.walk()):
               return clause.rstrip('; ')
   ```


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