sadpandajoe commented on code in PR #42588:
URL: https://github.com/apache/superset/pull/42588#discussion_r3684812928


##########
superset/sql/parse.py:
##########
@@ -1274,6 +1274,13 @@ def set_limit_value(
         Modify the `LIMIT` or `TOP` value of the SQL statement inplace.
         """
         if method == LimitMethod.FORCE_LIMIT:
+            # `SHOW` statements (`SHOW TABLES`, `SHOW DATABASES`, `SHOW CREATE
+            # TABLE`, etc.) have no real `LIMIT` slot in sqlglot's expression
+            # tree: setting `args["limit"]` doesn't get rejected, it renders a
+            # malformed statement with two `LIMIT` keywords, which engines
+            # like StarRocks reject outright. Leave them untouched.
+            if isinstance(self._parsed, exp.Show):

Review Comment:
   Snowflake's `Show` node accepts this exact `exp.Limit` shape, so `SHOW 
TABLES` previously rendered as valid `SHOW TABLES LIMIT 1000`; this return now 
drops the configured limit for a `FORCE_LIMIT` engine. Could this guard be 
restricted to dialects or SHOW forms where sqlglot actually produces the 
duplicate `LIMIT`?



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