codeant-ai-for-open-source[bot] commented on code in PR #42588:
URL: https://github.com/apache/superset/pull/42588#discussion_r3678758879


##########
tests/unit_tests/sql/parse_tests.py:
##########
@@ -2243,6 +2243,34 @@ def test_set_limit_value(
     assert statement.format() == expected
 
 
[email protected](
+    "sql",
+    [
+        "SHOW TABLES",
+        "SHOW DATABASES",
+        "SHOW CREATE TABLE test.will_test1",
+    ],
+)
+def test_set_limit_value_leaves_show_statements_unchanged(sql: str) -> None:
+    """
+    Regression for #36939: FORCE_LIMIT must not touch ``SHOW`` statements.
+
+    ``SHOW`` statements have no `LIMIT` clause in sqlglot's expression tree,
+    so forcing one via ``args["limit"]`` doesn't reject cleanly, it produces
+    a malformed statement with two ``LIMIT`` keywords (one from a stray
+    rendering of the bare ``Limit`` expression, one from the forced value).
+    StarRocks (and presumably other engines) reject that outright: "Getting
+    syntax error ... Unexpected input 'LIMIT'". The statement should be
+    left untouched instead, matching how ``SELECT`` statements without a
+    scannable row source aren't force-limited either.
+    """
+    statement = SQLStatement(sql, "starrocks")

Review Comment:
   **Suggestion:** The regression is exercised only with the `starrocks` 
dialect, so an implementation that special-cases StarRocks—or a 
dialect-specific parser/rendering regression in MySQL, Hive, Trino, or another 
`FORCE_LIMIT` engine—could pass this test while still corrupting `SHOW` 
statements elsewhere. Parameterize the engine and include the dialects whose 
callers use this path, or assert the dialect-independent `SHOW` behavior 
directly. [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Other FORCE_LIMIT dialects can regress unnoticed.
   - ❌ SQL Lab may submit malformed SHOW statements.
   - ⚠️ StarRocks-only coverage cannot enforce generic handling.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7c0e5c7e2f294c6b9cd407013ce54e95&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7c0e5c7e2f294c6b9cd407013ce54e95&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/sql/parse_tests.py
   **Line:** 2267:2267
   **Comment:**
        *Incomplete Implementation: The regression is exercised only with the 
`starrocks` dialect, so an implementation that special-cases StarRocks—or a 
dialect-specific parser/rendering regression in MySQL, Hive, Trino, or another 
`FORCE_LIMIT` engine—could pass this test while still corrupting `SHOW` 
statements elsewhere. Parameterize the engine and include the dialects whose 
callers use this path, or assert the dialect-independent `SHOW` behavior 
directly.
   
   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%2F42588&comment_hash=eea02de90481db8d19340fceb7df90a462f8820b83aee123e972f1fbd2798fab&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42588&comment_hash=eea02de90481db8d19340fceb7df90a462f8820b83aee123e972f1fbd2798fab&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]

Reply via email to