betodealmeida commented on code in PR #33473:
URL: https://github.com/apache/superset/pull/33473#discussion_r2093298182
##########
superset/models/core.py:
##########
@@ -762,11 +762,19 @@ def select_star( # pylint: disable=too-many-arguments
)
def apply_limit_to_sql(
- self, sql: str, limit: int = 1000, force: bool = False
+ self,
+ sql: str,
+ limit: int = 1000,
+ force: bool = False,
) -> str:
- if self.db_engine_spec.allow_limit_clause:
- return self.db_engine_spec.apply_limit_to_sql(sql, limit, self,
force=force)
- return self.db_engine_spec.apply_top_to_sql(sql, limit)
+ script = SQLScript(sql, self.db_engine_spec.engine)
+ statement = script.statements[-1]
+ current_limit = statement.get_limit_value() or float("inf")
+
+ if limit < current_limit or force:
Review Comment:
Moved the limit application logic here.
--
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]