dosubot[bot] commented on issue #36939:
URL: https://github.com/apache/superset/issues/36939#issuecomment-3717570811

   <!-- Answer -->
   This error happens because Superset automatically appends a LIMIT clause to 
non-SELECT statements like SHOW TABLES, SHOW DATABASES, and SHOW CREATE TABLE 
when running them in SQL Lab. StarRocks does not support LIMIT on these 
statements, so you get a syntax error about 'Unexpected input LIMIT'—even 
though the same statements work fine when run directly via SQLAlchemy, which 
does not add LIMITs or parse the SQL in this way.
   
   This behavior is due to Superset's SQL parsing and limit application logic, 
which was updated in version 6.0.0 to use the SQLScript class for parsing and 
applying limits. The logic is supposed to only add LIMIT to SELECT-like 
queries, but it can misclassify SHOW statements and add LIMIT anyway, causing 
the error you see in StarRocks ([details in PR 
#36599](https://github.com/apache/superset/pull/36599)).
   
   There is currently no configuration option to disable this automatic LIMIT 
for SHOW statements. The only workaround is to run these statements outside of 
Superset (for example, directly in a StarRocks client or via SQLAlchemy in 
Python). If you need to use these statements in Superset, you would have to 
patch the code to avoid applying LIMIT to SHOW statements, but this is not 
recommended for production.
   
   This is a known limitation and would require an upstream fix in Superset's 
SQL parsing logic to properly detect and skip LIMIT for SHOW statements in 
StarRocks.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f9b63f1f-a9e4-4e2f-9e59-f9835a045a20?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20error%20happens%20because%20Superset%20automatically%20appends%20a%20LIMIT%20clause%20to%20non-SELECT%20statements%20like%20SHOW%20TABLES%2C%20SHOW%20DATABASES%2C%20and%20SHOW%20CREATE%20TABLE%20when%20running%20them%20in%20SQL%20Lab.%20StarRocks%20does%20not%20support%20LIMIT%20on%20these%20statements%2C%20so%20you%20get%20a%20syntax%20error%20about%20%27Unexpected%20input%20LIMIT%27%E2%80%94even%20though%20the%20same%20statements%20work%20fine%20when%20run%20directly%20via%20SQLAlchemy%2C%20which%20does%20not%20add%20LIMITs%20or%20parse%20the%20SQL%20in%20this%20way.%0A%0AThis%20behavior%20is%20due%20to%20Superset%27s%20SQL%20parsing%20and%20limit%20application%20logic%2C%20which%20was%20updated%20in%20version%206.0.0%20to%20use%20the%20SQ
 
LScript%20class%20for%20parsing%20and%20applying%20limits.%20The%20logic%20is%20supposed%20to%20only%20add%20LIMIT%20to%20SELECT-like%20queries%2C%20but%20it%20can%20misclassify%20SHOW%20statements%20and%20add%20LIMIT%20anyway%2C%20causing%20the%20error%20you%20see%20in%20StarRocks%C2%A0%28%5Bdetails%20in%20PR%20%2336599%5D%28https%3A//github.com/apache/superset/pull/36599%29%29.%0A%0AThere%20is%20currently%20no%20configuration%20option%20to%20disable%20this%20automatic%20LIMIT%20for%20SHOW%20statements.%20The%20only%20workaround%20is%20to%20run%20these%20statements%20outside%20of%20Superset%20%28for%20example%2C%20directly%20in%20a%20StarRocks%20client%20or%20via%20SQLAlchemy%20in%20Python%29.%20If%20you%20need%20to%20use%20these%20statements%20in%20Superset%2C%20you%20would%20have%20to%20patch%20the%20code%20to%20avoid%20applying%20LIMIT%20to%20SHOW%20statements%2C%20but%20this%20is%20not%20recommended%20for%20production.%0A%0AThis%20is%20a%20known%20limitation%20and%20would%20req
 
uire%20an%20upstream%20fix%20in%20Superset%27s%20SQL%20parsing%20logic%20to%20properly%20detect%20and%20skip%20LIMIT%20for%20SHOW%20statements%20in%20StarRocks.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36939)


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