betodealmeida commented on a change in pull request #13521:
URL: https://github.com/apache/superset/pull/13521#discussion_r614411266



##########
File path: superset/views/core.py
##########
@@ -2537,6 +2537,14 @@ def sql_json_exec(  # pylint: 
disable=too-many-statements,too-many-locals
         if not (config.get("SQLLAB_CTAS_NO_LIMIT") and select_as_cta):
             # set LIMIT after template processing
             limits = [mydb.db_engine_spec.get_limit_from_sql(rendered_query), 
limit]
+            if limits[0] is None and limits[1] is None:
+                query.limiting_factor = LimitingFactor.NOT_LIMITED
+            elif limits[0] is None or limits[0] > limits[1]:
+                query.limiting_factor = LimitingFactor.DROPDOWN
+            elif limits[1] is None or limits[1] > limits[0]:
+                query.limiting_factor = LimitingFactor.QUERY
+            else:
+                query.limiting_factor = LimitingFactor.QUERY_AND_DROPDOWN

Review comment:
       ```suggestion
               if limits[0] is None or limits[0] > limits[1]:
                   query.limiting_factor = LimitingFactor.DROPDOWN
               elif limits[1] > limits[0]:
                   query.limiting_factor = LimitingFactor.QUERY
               else:  # limits[0] == limits[1]
                   query.limiting_factor = LimitingFactor.QUERY_AND_DROPDOWN
   ```
   
   > This logic makes sense. In your second set of code, how would we identify 
something that was not limited in it?
   
   Later, when `self._sql_json_sync` or `self._sql_json_async` are called, the 
limiting factor will be set to `NOT_LIMITED` if the limit was not applied.
   




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

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