betodealmeida commented on code in PR #36274:
URL: https://github.com/apache/superset/pull/36274#discussion_r2577725665
##########
superset/common/query_context_processor.py:
##########
@@ -267,17 +271,28 @@ def ensure_totals_available(self) -> None:
is_totals_query = (
not query.columns and query.metrics and not
query.post_processing
)
- if is_totals_query:
- totals_queries.append(i)
+ if is_totals_query and totals_idx is None:
+ totals_idx = i
+
+ if queries_needing_totals and totals_idx is not None:
+ totals_query = self._query_context.queries[totals_idx]
+ totals_query.row_limit = None
Review Comment:
I don't think it makes a difference in practice, but this is because if we
compute the totals for a query like this:
```sql
SELECT region, SUM(sales) as sales
FROM orders
GROUP BY region
LIMIT 50000
```
We want the totals query to not have a limit:
```sql
SELECT SUM(sales) as total_sales
FROM orders
```
Because the cardinality of the second query is always `<=` the cardinality
of the first the limit shouldn't matter.
--
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]